标签:
//判断是否为整形:
- (BOOL)isPureInt:(NSString*)string{
NSScanner* scan = [NSScannerscannerWithString:string];
int val;
return[scan scanInt:&val] && [scanisAtEnd];
}
//判断是否为浮点形:
- (BOOL)isPureFloat:(NSString*)string{
NSScanner* scan = [NSScannerscannerWithString:string];
float val;
return[scan scanFloat:&val] && [scanisAtEnd];
}
[转] 【iOS基础知识】之判断NSString是否为整数、浮点数
标签:
原文地址:http://www.cnblogs.com/Cheetah-yang/p/4894420.html