Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to convert string to nsnumber in objective c?



How to convert string to nsnumber in objective c?..

Answer / Km. Arti

To convert a string to an NSNumber object in Objective-C, you can use the following code:
```objectivec
NSString *yourString = @"42";
NSNumber *number = [yourString numberWithInteger:[yourString integerValue]]; // for integer values
// For floating point numbers:
double yourDouble = 3.14;
NSString *yourStringDouble = [NSString stringWithFormat:@"%f", yourDouble];
NSNumber *numberDouble = [yourStringDouble numberWithDouble:yourDouble];
```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Objective-C Interview Questions

What is an m file?

1 Answers  


Explain how to call a function in objective-c?

1 Answers  


Is objective c similar to java?

1 Answers  


What is difference between nil and nill?

1 Answers  


How different is objective c from swift?

1 Answers  


How does dispatch_once manages to run only once?

1 Answers  


Is objective c type safe?

1 Answers  


What happens when you create a block?

1 Answers  


Is closure a function?

1 Answers  


What is class extension? Why do we require them?

1 Answers  


What is the difference between underscore and self (i.e self.xx and _xx) ?

1 Answers  


How would I make a static strategy?

1 Answers  


Categories