判断字符串中是否包含汉字

- (BOOL) containsChinese:(NSString *)str {
    for(int i = 0; i < [str length]; i++) {
        int a = [str characterAtIndex:i];
        if( a > 0x4e00 && a < 0x9fff)
            return TRUE;
    }
    return FALSE;
}

猜你喜欢

转载自eric-gao.iteye.com/blog/1706957