028-86922220
建站资讯

网站建设资讯

为你提供网站建设行业资讯、网站优化知识、主机域名邮箱、网站开发常见问题等。

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://whjierui.cn/article/pjpjjg.html

其他资讯