逗号分隔千位NSString stringWithFormat [英] comma separated thousand NSString stringWithFormat

查看:117
本文介绍了逗号分隔千位NSString stringWithFormat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用

[NSString stringWithFormat:@"£%0.2f", 1000.99]

如果我没有达到正确的目标,请指导我吗?

Please guide me if I am not on the right track to achieve this?

推荐答案

参见 NSNumberFormatter

它可以处理所有数字格式需求,并以自动本地化的方式完成,正确使用时(因为世界各地的货币通常使用不同的标点符号和格式编写)。

It can handle all your numeric formatting needs and do so in an automatically localized fashion, when used correctly (since currencies around the world are often written with different punctuation & formatting).

特别是,请查看链接到顶部的数字格式指南类文档

In particular, check out the number formatting guide linked to at the top of the class documentation

这篇关于逗号分隔千位NSString stringWithFormat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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