Skip to content

Instantly share code, notes, and snippets.

@kyle-go
Created January 20, 2014 02:20
Show Gist options
  • Save kyle-go/8513894 to your computer and use it in GitHub Desktop.
Save kyle-go/8513894 to your computer and use it in GitHub Desktop.
getFirstPinyinChar
- (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