Reputation: 11231
I am extracting double data from sqlite3 database. But I want to display it only upto two decimal places. So how to truncate it.
Upvotes: 2
Views: 5661
Reputation:
Ah, Ben beat me to it! You might also find this http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html useful.
Upvotes: 0
Reputation: 85532
Use sprintf formatting with NSString: [NSString stringWithFormat: @"%.2f", myValue];
Upvotes: 7