+ (NSString*)hanZiToPinYinWithString:(NSString*)hanZi {
NSMutableString*pinyin = [hanZi mutableCopy];
// 转化出来的是带音标的拼音
CFStringTransform((__bridge CFMutableStringRef)pinyin, NULL, kCFStringTransformMandarinLatin, NO);
// 去掉音标
CFStringTransform((__bridge CFMutableStringRef)pinyin, NULL, kCFStringTransformStripCombiningMarks, NO);
NSLog(@"%@", pinyin);
return[pinyinuppercaseString];
}
网友评论