Escape code for % sign in NSString

The escape code for a percent sign is “%%”, so your code would look like this

[NSString stringWithFormat:@”%d%%”, someDigit];

This is also true for NSLog() and printf() formats.

Cited from http://stackoverflow.com/questions/739682/how-to-add-percent-sign-to-nsstring.

Blogged with the Flock Browser
Advertisements

Decoding a UTF-8 NSString