i am wondering how i do a % sign within a NSString, i have tried \% and \\%
Asked
Active
Viewed 1,990 times
6
user393273
- 1,430
- 5
- 25
- 48
-
3possible duplicate of [How to add percent sign to NSString](http://stackoverflow.com/questions/739682/how-to-add-percent-sign-to-nsstring) – Felix Kling Oct 11 '10 at 08:31
4 Answers
4
There's no special escaping required for percent signs. Just write:
str = @"Rate of Return (in %)";
...unless you mean NSString stringWithFormat. But your question doesn't say so.
Codo
- 75,595
- 17
- 168
- 206
3
According to Apple's 'String Format Specifiers' page, simply use %%.
For example:
NSString * aString = @"50%%";
izakage
- 43
- 4