@property (readonly) double doubleValue;
@property (readonly) float floatValue;
@property (readonly) int intValue;
@property (readonly) NSInteger integerValue NS_AVAILABLE(10_5, 2_0);
@property (readonly) long long longLongValue NS_AVAILABLE(10_5, 2_0);
在iOS 中有这样的string 转化
NSString * str = @"10.500";
NSLog(@"%@",[NSString stringWithFormat:@"%ld",(long)[str longLongValue]]);
打印结果 是10;
稍作检测 发现他们取值是从左边起 到第一个非数字的字符结束,
如果
NSString * str = @"a10.500";
NSLog(@"%@",[NSString stringWithFormat:@"%ld",(long)[str longLongValue]]);
输出为0;