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