成都创新互联网站制作重庆分公司

IOS字符串的Format可以对数值四舍五入

NSLog(@"%@", [NSString stringWithFormat:@"%.0f", 1.0003]);
NSLog(@"%@", [NSString stringWithFormat:@"%.0f", 1.9003]);
NSLog(@"%@", [NSString stringWithFormat:@"%.0f", 1.5003]);
NSLog(@"%@", [NSString stringWithFormat:@"%.0f", 1.4003]);
// 输出
1
2
2
1

网站题目:IOS字符串的Format可以对数值四舍五入
文章地址:http://cxhlcq.com/article/pjpjjg.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部