sprintf with NSString
So, I have been struggling to learn Objective C. Here is a snippet of code that might be helpful. Basically you can use NSString’s initWithFormat method to create a new NSString object and use it just like sprinf function in C
[[NSString alloc] initWithFormat:@”(%f,%f)”,center.x,center.y]
April 24th, 2008 at 8:06 am
Thanks! I too am learning Objective-C and have been trying to figure out an NSString-style sprintf. This does the trick.
September 24th, 2008 at 7:54 am
Thanks! This post was very helpful to me
Short and consise, just the way it should be!
mvh roger
November 11th, 2008 at 4:25 pm
[NSString stringWithFormat:@"(%f,%f)",center.x,center.y]