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

Is python static or dynamic?

1 Answers  


Is objective c superset of c?

1 Answers  


What is kvc and kvo? Give an example of using kvc to set value.

1 Answers  


What is an extension?

1 Answers  


What is dynamic dispatch method?

1 Answers  


Can a protocol have properties?

1 Answers  


How do I create an objective c class in xcode?

1 Answers  


What is the main difference between function calls and messages?

1 Answers  


What is m files document management?

1 Answers  


What are properties and instance variables in objective c and swift?

1 Answers  


Why swift is faster than objective c?

1 Answers  


Explain what is protocol in objective-c?

1 Answers  


Categories