您的位置:首页 > 其它

计算文字的个数

2016-07-22 10:49 253 查看
#pragma mark - 计算文字的个数
//- (BOOL)isChinesecharacter:(NSString *)string
//{
//    if (string.length == 0)
//    {
//        return NO;
//    }
//    unichar c = [string characterAtIndex:0];
//    if (c >=0x4E00 && c <=0x9FA5)
//    {
//        return YES;//汉字
//    }
//    else
//    {
//        return NO;//英文
//    }
//}
////计算汉字的个数
//- (NSInteger)chineseCountOfString:(NSString *)string
//{
//    int ChineseCount = 0;
//    if (string.length == 0)
//    {
//        return 0;
//    }
//    for (int i = 0; i<string.length; i++)
//    {
//        unichar c = [string characterAtIndex:i];
//        if (c >=0x4E00 && c <=0x9FA5)
//        {
//            ChineseCount++;//汉字
//        }
//    }
//    return ChineseCount;
//}
////计算字母的个数
//- (NSInteger)characterCountOfString:(NSString *)string
//{
//    int characterCount = 0;
//    if (string.length == 0)
//    {
//        return 0;
//    }
//    for (int i = 0; i<string.length; i++)
//    {
//        unichar c = [string characterAtIndex:i];
//        if (c >=0x4E00 && c <=0x9FA5)
//        {
//        }
//        else
//        {
//            characterCount++;//英文
//        }
//    }
//    return characterCount;
//}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: