重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

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://cqcxhl.com/article/pjpjjg.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP