获取中文对应拼音

NSMutableString *pinyin = [@"惠州" mutableCopy];

//将汉字转换为拼音(带音标)

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

NSLog(@"%@", pinyin);

//去掉拼音的音标

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

NSLog(@"%@", pinyin);

你可能感兴趣的:(获取中文对应拼音)