How can I convert a NSString containing a number of any primitive data type (e.g. int, float, char, unsigned int
NSString
int
float
char
unsigned int
You can just use [string intValue] or [string floatValue] or [string doubleValue] etc
[string intValue]
[string floatValue]
[string doubleValue]
You can also use NSNumberFormatter class: