Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8986459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:33:18+00:00 2026-06-15T21:33:18+00:00

code: -(IBAction)addRounds{ NSString *addText = [NSString stringWithFormat:@%@, self.roundsF.text]; NSString *totalText = [NSString stringWithFormat:@%@, self.totalRoundsF.text];

  • 0

code:

-(IBAction)addRounds{
NSString *addText = [NSString stringWithFormat:@"%@", self.roundsF.text];
NSString *totalText = [NSString stringWithFormat:@"%@", self.totalRoundsF.text];

int value = [totalText intValue] - [addText intValue];

NSNumber *val = [NSNumber numberWithInt:value];

NSString *final = [NSString stringWithFormat:@"%@", val.stringValue];

self.totalRoundsF.text = final;
}

The above code works perfectly, however when it displays the data into the textfield, it will show something like : -10 the number 10 is correct, i just dont want a - sign. Any help is greatly appreciated, Thank you very much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:33:20+00:00Added an answer on June 15, 2026 at 9:33 pm

    You do not want negative value at all? In that case use abs absolute value. This will always give you positive values.

    Depending on the type of your variable, one of abs(int), labs(long), llabs(long long), imaxabs(intmax_t), fabsf(float), fabs(double), or fabsl(long double).

    These functions are part of the C library and are present in Objective-C library as well. You might have to import math.h to use them.

    so in your case it would be abs(val); //will give +10

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Some simple code: - (IBAction)Up_Down:(UIStepper *)sender { double value = [sender value]; [NumDayLabel setText:[NSString
Check this code (My Custom Keyboard): -(IBAction) updateTextBackSpace:(id)sender { if([txtview.text length]>0) { NSString *deletedLastCharString
I have this code: - (IBAction) checkIt:(id)sender{ NSString *button = [[(UIImageView *)sender label]text]; I
Here is my code: -(IBAction)encryptText:(id)sender { key = self.tvKey.text; CCCryptorStatus status = kCCSuccess; algorithm
Here's the code: - (IBAction) charlieInputText:(id)sender { //getting value from text field when entered
Can someone explain this code - (IBAction)backspacePressed { self.display.text =[self.display.text substringToIndex: [self.display.text length] -
I have this code -(IBAction) generateFlashNow:(id)sender{ [textField resignFirstResponder]; NSString *string1 = textField.text; //NSString *string2
Here is the code: -(IBAction)customButtonPressed:(id)sender { NSString *text = Field.text; //label is called Label
How can I put my NSInteger into my NSString stringWithFormat: my code: -(IBAction)main:(id)sender {
I have this code : -(IBAction)OkButtonPressed:(id)sender{ NSLog(@BTN OK); RecherchePartenaireTableView *recherchePartenaireTableView=[[RecherchePartenaireTableView alloc]init]; recherchePartenaireTableView.mytext=textFieldCode.text; [self.navigationController popViewControllerAnimated:YES];

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.