#pragma mark -获取一段字符串中的中文字
+ (NSArray *)getAStringOfChineseWord:(NSString *)string
{
if (string == nil || [string isEqual:@""])
{
return nil;
}
NSMutableArray *arr = [[NSMutableArray alloc]init];
for (int i=0; i<[string length]; i++)
{
int a = [string characterAtIndex:i];
if (a < 0x9fff && a > 0x4e00)
{
[arr addObject:[string substringWithRange:NSMakeRange(i, 1)]];
}
}
return arr;
}
#pragma mark -获取一段字符串中的中文字和中文字符
+ (NSArray *)getAStringOfChineseCharacters:(NSString *)string
{
if (string == nil || [string isEqual:@""])
{
return nil;
}
NSMutableArray *arr = [[NSMutableArray alloc]init];
for (int i=0; i<string.length; i++)
{
NSRange range = NSMakeRange(i, 1);
NSString *subStr = [string substringWithRange:range];
const char *c = [subStr UTF8String];
if (strlen(c)==3)
{
[arr addObject:subStr];
}
}
return arr;
}