NSMutableString * ms = [[NSMutableString alloc] initWithString:@"中华人民共和国"];
if (CFStringTransform((__bridge CFMutableStringRef)ms, 0, kCFStringTransformMandarinLatin, NO)) {
NSLog(@"pinyin: %@", ms);
}//有声调
if (CFStringTransform((__bridge CFMutableStringRef)ms, 0, kCFStringTransformStripDiacritics, NO)) {
NSLog(@"pinyin: %@", ms);
}//无声调
时间: 2024-10-14 13:09:25