#define NUMANDD @".0123456789"
#define OTHERNUM @"./0123456789"
#define GREADPRICE @"_.0123456789|"
上面是想要的格式类型
下面是方法
-(BOOL)isOnlyhasNumberAndpointWithString:(NSString*)string withRule:(NSString*)rule
{
NSCharacterSet *cs=[[NSCharacterSet characterSetWithCharactersInString:rule] invertedSet];
NSString *filter=[[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];
return[stringisEqualToString:filter];
}
网友评论