IOS 汉字转拼音

//汉字转拼音

+ (NSString *)transform:(NSString *)chinese

{

NSMutableString *pinyin = [chinese mutableCopy];

CFStringTransform((__bridge CFMutableStringRef)pinyin, NULL, kCFStringTransformMandarinLatin, NO);

CFStringTransform((__bridge CFMutableStringRef)pinyin, NULL, kCFStringTransformStripCombiningMarks, NO);

NSString *pinyinStr = [pinyin stringByReplacingOccurrencesOfString:@" " withString:@""];

return pinyinStr;

}

你可能感兴趣的:(IOS 汉字转拼音)