NSString *str = [NSString stringWithFormat:@"%g",12.10];
NSLog(@"str = %@",str);
输出:
str = 12.1
http://stackoverflow.com/questions/19667918/how-to-not-show-unnecessary-zeros-when-given-integers-but-still-have-float-answe
http://pubs.opengroup.org/onlinepubs/009695399/functions/printf.html
版权声明:本文为博主原创文章,未经博主允许不得转载。