Separate names with a comma.
Discussion in 'iPhone/iPad Programming' started by Jeremy1026, Sep 3, 2008.
Is it possible to display a float variable only out to the 2nd decimal place (hundredths place)?
Look at the documentation for NSString stringWithFormat. You can specify the number of decimal places easily.
Thanks for your help.
Incase anyone else finds this in a search, the way to do it is to use %.2f in the stringWithFormat: method.
Yup - that's a winner...
(more fodder for searches)
The String Programming Guide for Cocoa section on String Format Specifiers describes all of the options, but for things like the ".2" part you need to see the referenced IEEE printf() description.