To format a float to 2 decimal places in Objective-C you can use the following snippet.

Sample Objective-C

NSString* formattedVariable = [NSString stringWithFormat:@"%.02f", myFloatVariable];

5 thought on “How to format a float to 2 decimal places in Objective-C”

Leave a Reply