Try the search, it's linked to some great forums

Tuesday, June 28, 2011

NSString formatting

The following formatting strings are commonly used
%2.3f   floating point number 2 digits, 3 decimal places
%d       integer number
%@     object descriptor

General format for NSString / NSLog message;
NSLog(@"This is the message along with it's variable %@", myObject);
NSString *leftPostCardName = [NSString stringWithFormat:@"image%d.jpg",(i+1)]; 
UIImage *leftPhoto = [UIImage imageNamed:(@"%@", leftPostCardName)];                       
 

And try this for converting from string to number
NSString *myString = (string initialization here)
float stringFloat = [myString floatValue];