标签:get dex 获取 bsp ast ati 中文 array isequal
#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;
}
标签:get dex 获取 bsp ast ati 中文 array isequal
原文地址:http://www.cnblogs.com/akiha/p/6506991.html