Skip to content

Instantly share code, notes, and snippets.

@ourui
Last active December 23, 2015 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ourui/c548dc0a6e3de3ccd03b to your computer and use it in GitHub Desktop.
Save ourui/c548dc0a6e3de3ccd03b to your computer and use it in GitHub Desktop.
Covert Chinese Word To PinYin
NSMutableString *ms = [[NSMutableString alloc] initWithString:@"我是中国人"];
if (CFStringTransform((__bridge CFMutableStringRef)ms, 0, kCFStringTransformMandarinLatin, NO)) {
NSLog(@"Pingying: %@", ms); // wǒ shì zhōng guó rén
}
if (CFStringTransform((__bridge CFMutableStringRef)ms, 0, kCFStringTransformStripDiacritics, NO)) {
NSLog(@"Pingying: %@", ms); // wo shi zhong guo ren
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment