#pragma mark-Gets the Chinese text in a string
+ (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-Get Chinese and Chinese characters in a string
+ (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;
}
iOS development get Chinese characters and Chinese characters in a string