ios - Show the float value in formatted string two digits after decimal in iPhone -


i have float number in insert comma after thousands value works fine

nsnumberformatter *formatter = [nsnumberformatter new]; [formatter setnumberstyle:nsnumberformatterdecimalstyle]; // line important!  nsstring *formatted = [formatter stringfromnumber:[nsnumber numberwithfloat:appdelegate.c_wnd_clininf_average_default]]; 

but shows 1,947 want show 1,947.00 idea how formate this.

thanks

have tried using -setmaximumfractiondigits nsnumberformatter?

so, try like:

[formatter setmaximumfractiondigits:2]; [formatter setminimumfractiondigits:2]; 

this way deal nsnumberformatter , don't need call on nsstring.


Comments

Popular posts from this blog

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -