iphone - How to format double to money format? Eg: 3.234,12 -


i have string input user, string treated have numbers, such as: "3472042".

i convert string double value, want formatted money value, like: 3.472,042

just decimalformat in java if helps.

i tried things nsnumberformatter no luck. can give me hand that?

used @ first:

         nsstring *string = txtotherpower.text;         nscharacterset *removecharset = [nscharacterset charactersetwithcharactersinstring:@"•€£¥./:;@#$%&*(){}[]!?\\-|_=+\"`'~^abcdefghijklmnopqrstvwxyz' '"];         string = [[string componentsseparatedbycharactersinset:removecharset] componentsjoinedbystring:@""]; 

so acceptable characters comma "," , numbers. problem if type "2,2,2,2,,,,,1,,2" won't anything. , messes string/number.

i need formatted money values... ideas?

create nsnumberformatter, set style nsnumberformattercurrencystyle or nsnumberformatterdecimalstyle (or, if styles don't work you, configure setpositiveformat:, setnegativeformat: etc.), , convert number string stringfromnumber:.

see documentation class details.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -