Created
March 9, 2014 22:32
-
-
Save kharmabum/9455944 to your computer and use it in GitHub Desktop.
Looping through NSString Unicode characters - http://www.objc.io/issue-9/unicode.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *s = @"The weather on \U0001F30D is \U0001F31E today."; | |
// The weather on ๐ is ๐ today. | |
NSRange fullRange = NSMakeRange(0, [s length]); | |
[s enumerateSubstringsInRange:fullRange | |
options:NSStringEnumerationByComposedCharacterSequences | |
usingBlock:^(NSString *substring, NSRange substringRange, | |
NSRange enclosingRange, BOOL *stop) | |
{ | |
NSLog(@"%@ %@", substring, NSStringFromRange(substringRange)); | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment