//联系人:石虎QQ: 1224614774昵称:嗡嘛呢叭咪哄
一、动态改变小数点个数
- (void)viewDidLoad {
[superviewDidLoad];
NSInteger pointNum =7;
CGFloat num =3.23323000000;
NSString *string = [NSString stringWithFormat:@"%%.%ldf",pointNum];
NSString *str = [NSString stringWithFormat:string, num];
NSLog(@"str %@", str);
}
打印结果:2017-09-17 00:07:49.487 dddd[99756:2847097]str 3.2332300
二、效果图:
图1:
图2:
网友评论