中文转拼音
- (NSString *)getPinYinFrom:(NSString *)chinese { CFMutableStringRef string = CFStringCreateMutableCopy(NULL, 0, (__bridge CFMutableStringRef)[NSMutableString stringWithString:chinese]); CFStringTransform(string, NULL, kCFStringTransformMandarinLatin, NO); CFStringTransform(string, NULL, kCFStringTransformStripDiacritics, NO); NSMutableString *aNSString = (__bridge NSMutableString *)string; NSString *finalString = [aNSString stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%c", 32] withString:@""]; NSLog(@"%@", finalString); return finalString; }