开发者

use '%' in output

Probably a very simple problem and I have been looking for the answer but can not find the it, probably because i have not found out what to ask.

I want the following output, see the '%' character in the output:

(33%)

i just do not understand how to format in the "%" character so it is seen in the output.

txt2 = [txt2 stringByAppendingFormat:@"(%i)", percentage];

I know that the above stringByAppendin开发者_开发知识库gFormat is wrong. I would very much appreciate any help.


Escape it with another % so you get something like this:

txt2 = [txt2 stringByAppendingFormat:@"(%i%%)", percentage];

For a list of all format specifiers to use with the formatting functions, see here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜