使用 NSString 显示百分比 [英] Displaying percentage using NSString

查看:86
本文介绍了使用 NSString 显示百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何在objective-c中显示百分比字符?

How do we display percentage character in objective-c?

我正在使用这个:

[NSString localizedStringWithFormat:@"%.2f %", percentageQs]

但由于某种原因,它无法识别 %.以为我可以用这个 \ 来逃避它,但我错了.

But for some reason, it doesn't recognize the %. thought i could escape it using this \ but i was so wrong.

推荐答案

今天早些时候有人问了一个标记为 C 的类似问题:如何转义 C 中的符号 .这里的答案是相同的...使用双 %%.

There was a similar question tagged C asked earlier today: How to escape the sign in C . Answer here is the same... use a double %%.

这篇关于使用 NSString 显示百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆