iphone - NSNumber with commas -
iphone - NSNumber with commas -
maybe silly reply i'm pretty new on ios.. have show number in specific way in app. currently, have numbers receive service in nsstring. but, e.g. if have number: 123456789, need show in label 123.456.789 .. knows if there way that?
edit: add together ios , iphone tags
here's site examples of how utilize nsnumberformatter
.
http://iphonedevelopertips.com/cocoa/formatting-numbers-nsnumberformatter-examples.html
nsnumberformatter *formatter = [[nsnumberformatter alloc] init]; [formatter setnumberstyle:nsnumberformatterdecimalstyle]; nsstring *formattedoutput = [formatter stringfromnumber:[attributesdict objectforkey:nsfilesystemfreesize]]; nslog(@"system free space: %@", formattedoutput);
if number comes in string first, you'll need create number out of first can using nsstring
's intvalue
method:
http://developer.apple.com/library/mac/#documentation/cocoa/reference/foundation/classes/nsstring_class/reference/nsstring.html#//apple_ref/occ/instm/nsstring/intvalue
iphone ios nsnumber nsnumberformatter
Comments
Post a Comment