Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Rhalliwell1

macrumors 6502a
Original poster
May 22, 2008
588
1
Hi,

I am just starting to learn objective-c and can't find a way to convert from a String to a float (or any other variable type.)
Could anyone give me a point in the right direction?

Cheers :)
 
To convert a string to a float:

Code:
NSString *str = @"10.0";
float f = [str floatValue];
NSLog(@"float = %lf", f);
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.