OC判断字符串是否是中文

OC判断一个字符串是否都是中文code

-(BOOL)IsChinese:(NSString *)str {
    BOOL isChinese = YES;
    for(int i=0; i< [str length];i++){
        int a = [str characterAtIndex:i];
        if( a >= 0x4e00 && a <= 0x9fff)
        {
            
        }else{
            isChinese = NO;
        }
    }
    return isChinese;
    
}
相关文章
相关标签/搜索