NSString *name = @"陈";
NSMutableString *str = [NSMutableString stringWithString:name];
CFStringTransform((CFMutableStringRef)str,NULL, kCFStringTransformMandarinLatin,NO);
//再转换为不带声调的拼音
CFStringTransform((CFMutableStringRef)str,NULL, kCFStringTransformStripDiacritics,NO);
//转化为大写拼音
NSString *pinYin = [str capitalizedString];
NSString *Frist = [pinYin stringByPaddingToLength:1 withString:pinYin startingAtIndex:0];
NSLog(@"pinYin = %@", Frist);
网友评论