可能重复:
NSString stringWithFormat adding a percent
这里有个问题。
我有个密码:
int value = [sender value];
[overLabel setText:[NSString stringWithFormat:@"Overhead: %d", (int)value]];
这将标签设置为(例如):
Overhead: 10
我想把它设为:
Overhead: 10%
如何将%实现到字符串中,使其不用于打印值,但将其打印为实际的%字符。
谢谢!
发布于 2011-11-22 22:33:40
只需投入2 %,像这样:
[overLabel setText:[NSString stringWithFormat:@"Overhead: %d %%", (int)value]];
https://stackoverflow.com/questions/8234823
复制相似问题