判断NSString中是否包含中文
-(BOOL)isChinese:(NSString *)str
{
NSString *match=@"(^[\u4e00-\u9fa5]+$)";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF matches %@", match];
return [predicate evaluateWithObject:str];
}
判断NSString中是否包含中文
-(BOOL)isChinese:(NSString *)str
{
NSString *match=@"(^[\u4e00-\u9fa5]+$)";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF matches %@", match];
return [predicate evaluateWithObject:str];
}
本文标题:判断NSString中是否包含中文
本文链接:https://www.haomeiwen.com/subject/jlxirxtx.html
网友评论