从字符串中提取数字
使用一个值方法可将字符串转换为数字,分别返回3,1,3.141592 ,3.141592
NSString *s1 = @"3.141592";
NSLog(@"%d", [s1 intValue]);
NSLog(@"%d", [s1 boolValue]); // 没值就是0
NSLog(@"%f", [s1 floatValue]);
NSLog(@"%f", [s1 doubleValue]);
2013-05-17 14:16:07.297 test1[389:303] 3
2013-05-17 14:16:07.299 test1[389:303] 1
2013-05-17 14:16:07.300 test1[389:303] 3.141592
2013-05-17 14:16:07.300 test1[389:303] 3.141592