Skip to content

Instantly share code, notes, and snippets.

@nscoding
Created November 26, 2013 16:22
Show Gist options
  • Save nscoding/7661303 to your computer and use it in GitHub Desktop.
Save nscoding/7661303 to your computer and use it in GitHub Desktop.
NSString check if the string contains composed 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