iOS 判断只有数字、小数点和减号
#define NUMBERS @"0123456789.-"
//数字
#define NUM @"0123456789"
//字母
#define ALPHA @"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
//数字和字母
#define ALPHANUM @"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
//数字和点
#define NUMANDD @".0123456789"
#pragma mark -是否只包含数字,小数点,负号
-(BOOL)isOnlyhasNumberAndpointWithString:(NSString *)string{
NSCharacterSet *cs=[[NSCharacterSet characterSetWithCharactersInString:NUMBERS] invertedSet];
NSString *filter=[[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];
return [string isEqualToString:filter];
}