views:

193

answers:

1

Example:

I have a float value like 1294322.0000000, and I want to print it out in a label, like that:

1.294.322

So at every thousands-position one point inbetween. I bet you know what I mean. Don't know the exact english words for that.

Or, for example, I have a float like that: 15.29, then it should look like "15,29".

Or a float like 1422, which should look like 1.422

If there is no floating-point precision after the ",", I don't want to print it. So for example:

4.311 is correct, but 4.311,00 would be not wanted.

Are there useful classes that help with this number formatting problems in objective-c / iphone sdk / cocoa touch?

+3  A: 

Take a look at NSNumberFormatter.

mouviciel