我有以下两个值:0.000900137869045636
我想转换成NSString
我尝试了下面的代码,但不管怎样,它都将值舍入为:0.000900138

[NSString stringWithFormat:@"%.20lf", [currentLocation coordinate].latitude];

我该怎么做才能保持原来的双号?
谢谢您。

最佳答案

使用创建nsnumber
NSNumber *myDoubleNumber = [NSNumber numberWithDouble:myDouble];
然后打电话
[myDoubleNumber stringValue];

关于objective-c - Objective-C:将整个double值转换为字符串而不会丢失数据,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16487972/

10-12 13:59
查看更多