I'm writing in ace app, I've got a Jason object whose value is represented by the string, Some:
{"price": "20000"} And for the ease of readability, I want to format it with command, and I Have found a way, but I think it's a crazy clanky (I probably just did not use the right words in Google)
NSNumberFormatter * formatter = [NSNumberFormatter new]; [Setter Settlement Style: NSNumberFormatterDecimalStyle]; NSString value = [NSString stringWithFormat: @ "$% @", [formatter stringFromNumber: [NSNumber numberElectrical: [value intValue]]]]; This is very complicated for me to get the proper formatting
- Convert NSSTING to a bowel.
- Convert int to nsnm.
- Convert NSNM to NSSTING
-
Create a new string with the appropriate format (@ David / @ van) How do I leave this step!) <
Best for currency NSNumberFormatterCurrencyStyle NSNumberFormatter * formatter = [NSNumberFormatter new] ; [Setter Settlement Style: NSNumberFormatterCurrencyStyle]; NSNumber * price = @ ([priceTextFromJSON double value]); NSString * priceText = [format stringfarmNumber: value];
No comments:
Post a Comment