% character in target line c

I am wondering how I make the% sign inside NSString, I tried \% and \\%

+6
objective-c iphone nsstring
source share
4 answers

Try %% .

Short question, short answer. :)

+14
source share

just put %% on using the% sign in object c.

+4
source share

There is no special exception for percent signs. Just write:

 str = @"Rate of Return (in %)"; 

... if you do not mean NSString stringWithFormat. But your question does not say that.

+4
source share

According to the Apple String Format Specifiers page, just use %% .

For example:

NSString * aString = @"50%%";

Link: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html

+3
source share

All Articles