NSString *test = @"34.";
float testFloat = [test floatValue];
NSNumber *testNum = [NSNumber numberWithFloat:testFloat];
NSLog(@"testNum = %@", testNum);
打印出34
我想要小数点的NSNumber格式打印,即34.
how?
NSString *test = @"34.";
float testFloat = [test floatValue];
NSNumber *testNum = [NSNumber numberWithFloat:testFloat];
NSLog(@"testNum = %@", testNum);
打印出34
我想要小数点的NSNumber格式打印,即34.
how?
2 回答1.1k 阅读
1 回答1k 阅读✓ 已解决
1 回答2.7k 阅读
1 回答1.4k 阅读
1.7k 阅读
1 回答1.1k 阅读
1 回答939 阅读
刚刚用断点测试了一下
所以在nsstring的floatValue时就错了。