Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有几个浮点数,它们都存储在一个可变字符串中。但是在显示它们时它显示 2011.00000 尽管 2011 年,所以我希望它格式化它。有什么建议么。
谢谢
NSString* str = [NSString stringWithFormat:@"%.f", float_number];
您可以将它们放入浮点数然后使用 stringWithFormat(@"%f4.0", 吗?
利用
NSString* sa = [NSString stringWithFormat: @"%0.0f", 22323.4342];