On Apr 19, 2012, at 6:57 AM, Kirk Kerekes wrote: > > On Apr 18, 2012, at 2:00 PM, cocoa-dev-requ...@lists.apple.com wrote: > >> Re: Displaying '%' in the UI (Velocityboy) > > As a possibly more clear alternative to escaping the %, you could use: > > [NSString stringWithFormat:@"%.0f%@",ratio1, @"%"] > > Or, even more cocoa-fied ObjC: > > [NSString stringWithFormat:@"%@%@",[NSNumber numberWithFloat: ratio1], @"%"] > > (trusting NSNumber's -description method for formatting) > > or, > > [NSString stringWithFormat:@"%ul%@",[[NSNumber numberWithFloat: ratio1] > integerValue], @"%"]
I strongly recommend just using NSNumberFormatter with NSNumberFormatterPercentStyle, which formats percentage values according to the user's locale. Preston _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com