//给字符串分理出数字字符
+ (NSString *)segmentStringWith:(NSString *)str {
NSMutableString *mutStr = [NSMutableString string];
NSMutableArray *mutArrShu = [NSMutableArray arrayWithCapacity:0];
for (NSInteger i = 0; i < str.length; i++) {
NSString *a = [str substringToIndex:i+1];
a = [a substringFromIndex:i];
[mutArrShu addObject:a];
}
for (NSString *b in mutArrShu) {
NSString * emailRegex = @"^[0-9]*$";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
BOOL isShu = [emailTest evaluateWithObject:b];
if (isShu) {
[mutStr appendString:b];
}
}
return mutStr;
}
+ (NSString *)segmentStringWith:(NSString *)str {
NSMutableString *mutStr = [NSMutableString string];
NSMutableArray *mutArrShu = [NSMutableArray arrayWithCapacity:0];
for (NSInteger i = 0; i < str.length; i++) {
NSString *a = [str substringToIndex:i+1];
a = [a substringFromIndex:i];
[mutArrShu addObject:a];
}
for (NSString *b in mutArrShu) {
NSString * emailRegex = @"^[0-9]*$";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
BOOL isShu = [emailTest evaluateWithObject:b];
if (isShu) {
[mutStr appendString:b];
}
}
return mutStr;
}