Created
November 26, 2013 16:22
-
-
Save nscoding/7661303 to your computer and use it in GitHub Desktop.
NSString check if the string contains composed characters.
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
+ (BOOL)stringContainsComposedCharacters:(NSString *)string | |
{ | |
__block BOOL contains = NO; | |
[string enumerateSubstringsInRange:NSMakeRange(0, string.length) | |
options:NSStringEnumerationByComposedCharacterSequences | |
usingBlock: | |
^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) | |
{ | |
if (substringRange.length > 1) | |
{ | |
contains = YES; | |
*stop = YES; | |
} | |
}]; | |
return contains; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment