/** * 正则表达式匹配中文 */ - (BOOL)isRegexMatching:(NSString *)str; { NSString *regex = @"^[\u4E00-\u9FFF]+$"; return [[NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex] evaluateWithObject:str]; }
时间: 2024-10-06 14:26:03
/** * 正则表达式匹配中文 */ - (BOOL)isRegexMatching:(NSString *)str; { NSString *regex = @"^[\u4E00-\u9FFF]+$"; return [[NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex] evaluateWithObject:str]; }