NSString - max 1 decimal of a float

Posted by ncohen on Stack Overflow See other posts from Stack Overflow or by ncohen
Published on 2010-04-29T09:20:52Z Indexed on 2010/04/29 9:27 UTC
Read the original article Hit count: 443

Filed under:
|
|

Hi everyone,

I would like to use a float in a NSString. I used the stringWithFormat and a %f to integrate my float into the NSString. The problem is that I would like to display only one decimal (%.1f) but when there is no decimals I don't want to display a '.0' .

How can I do that?

Thanks

© Stack Overflow or respective owner

Related posts about iphone

Related posts about nsstring