NSString*str = fd.text;
for(inti =0; i
NSString*string = [strsubstringFromIndex:i];
NSString *regex = @"[\u4e00-\u9fa5]{0,}$"; // 中文
// 2、拼接谓词
NSPredicate *predicateRe1 = [NSPredicate predicateWithFormat:@"self matches %@", regex];
// 3、匹配字符串
BOOLresualt = [predicateRe1evaluateWithObject:string];
if(resualt){
str = [strstringByReplacingOccurrencesOfString:[str substringFromIndex:i] withString:@""];
}
}
网友评论