/**
* emoji表情过滤
*/
+(NSString *)filterEmoji:(NSString *)string {
NSUInteger len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
const char *utf8 = [string UTF8String];
char *newUTF8 = malloc( sizeof(char) * len );
int j = 0;
for ( int i = 0; i < len; i++ ) {
unsigned int c = utf8;
BOOL isControlChar = NO;
if ( c == 4294967280 ||
c == 4294967089 ||
c == 4294967090 ||
c == 4294967091 ||
c == 4294967092 ||
c == 4294967093 ||
c == 4294967094 ||
c == 4294967095 ||
c == 4294967096 ||
c == 4294967097 ||
c == 4294967088 ) {
i = i + 3;
isControlChar = YES;
}
if ( c == 4294967266 || c == 4294967267 ) {
i = i + 2;
isControlChar = YES;
}
if ( c == 4294967234 ) {
i = i + 1;
isControlChar = YES;
}
if ( !isControlChar ) {
newUTF8[j] = utf8;
j++;
}
}
newUTF8[j] = '\0';
NSString *encrypted = [NSString stringWithCString:(const char*)newUTF8
encoding:NSUTF8StringEncoding];
free( newUTF8 );
return encrypted;
}