Created
January 20, 2014 02:20
-
-
Save kyle-go/8513894 to your computer and use it in GitHub Desktop.
getFirstPinyinChar
This file contains hidden or 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
| - (char)getFirstPinyinChar:(NSString *)text { | |
| NSInteger index = [[UILocalizedIndexedCollation currentCollation] sectionForObject:text collationStringSelector:@selector(self)]; | |
| NSString *englishLetter = [[[UILocalizedIndexedCollation currentCollation] sectionIndexTitles] objectAtIndex:index]; | |
| return [englishLetter characterAtIndex:0]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment