问题
i am wondering how i do a % sign within a NSString, i have tried \% and \\%
回答1:
Try %%.
Short question, short answer. :)
回答2:
just put %% to use a % sign within objective c.
回答3:
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.
回答4:
According to Apple's 'String Format Specifiers' page, simply use %%.
For example:
NSString * aString = @"50%%";
Reference: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html
来源:https://stackoverflow.com/questions/3904615/sign-in-string-objective-c