IOS字符串的Format可以对数值四舍五入-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

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

其他资讯