formatting value in a string
if i have a value stored like:
i'd like to have a
so if i use NSLog or bitmapfont for this integer, what is displayed will be:
1,000,000,000,000
do exists this king od formatter?
thanks
Code:
long long unsigned x=1000000000000;Code:
NSString *strx=[...];1,000,000,000,000
do exists this king od formatter?
thanks
found it:
long num = 1000000000;
NSNumberFormatter *fmt = [[NSNumberFormatter alloc] init];
fmt.positiveFormat = @"#,###";
NSLog(@"%@", [fmt stringFromNumber:[NSNumber numberWithLong:num]]);
long num = 1000000000;
NSNumberFormatter *fmt = [[NSNumberFormatter alloc] init];
fmt.positiveFormat = @"#,###";
NSLog(@"%@", [fmt stringFromNumber:[NSNumber numberWithLong:num]]);
You might consider a localized formatter for places where the thousands separator is not a comma.
thanks for suggestion! i'll look for it
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Getting a value from a String | Megamac04 | 5 | 3,316 |
Jan 31, 2010 04:23 PM Last Post: smasher |
|
| Parsing from a string to something faster? | Madrayken | 3 | 2,695 |
Aug 10, 2009 03:32 PM Last Post: smasher |
|
| Is -fconstant-string-class broken under the XCode/Next runtime | Justin Brimm | 17 | 6,692 |
Jun 12, 2008 01:04 PM Last Post: Justin Brimm |
|
| string to interger comparison? | dareuhl | 8 | 3,863 |
May 22, 2008 05:44 PM Last Post: OneSadCookie |
|
| char array versus pointer to string constant question | WhatMeWorry | 7 | 6,634 |
Jan 30, 2007 12:26 PM Last Post: bronxbomber92 |
|

