How to bypass emojis in NSString There is an NSString method used to bypass an NSString substring
NSString *text = @"2012πζ们 ππππππΊπΈπ·πΊπ°π·π―π΅"; [text enumerateSubstringsInRange:NSMakeRange(0, [text length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) { printf("%s- ",[substring UTF8String]); }];
Guess what the conclusion is?
Output:
2- 0- 1- 2- π- ζ- 们- - π- π- π- π- π- π·- πΊ- π°- π·- π―- π΅- πΊ- πΈ-
Instead
2- 0- 1- 2- π- ζ- 们- - π- π- π- π- π- π·πΊ- π°π·- π―π΅- πΊπΈ-
Like the American flag πΊπΈ, it consists of πΊ and πΈ The length of the flag appears to be 4, and they consist of two characters with a length of-2. while NSString is listed, it gives me πΊ and πΈ, not πΊπΈ
When a string is in a UITextView, a BACKSPACE in the Keyboard is used, it can handle the deletion of emoji πΊπΈ, not πΈ.
In my application, I created a custom emoji keyboard, and there is a DELETE button. I want the DELETE button to work just like the BACKSPACE button on the keyboard.
Does anyone know how to handle this?
aelam source share