Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
NSMutableString *pinyin = [name mutableCopy];
if (!CFStringTransform((__bridge CFMutableStringRef)pinyin, 0, kCFStringTransformMandarinLatin, NO)) {
DDLogWarn(@"拼音转换[步骤1]失败: %@ -> %@", name, pinyin);
}
if (!CFStringTransform((__bridge CFMutableStringRef)pinyin, 0, kCFStringTransformStripDiacritics, NO)) {
DDLogWarn(@"拼音转换[步骤2]失败: %@ -> %@", name, pinyin);
}
pinyin = [pinyin stringByReplacingOccurrencesOfString:@" " withString:@""];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.