//汉字转拼音
NSMutableString *mutableString = [NSMutableString stringWithString:person.name];
CFStringTransform((CFMutableStringRef)mutableString, NULL, kCFStringTransformToLatin, false);
mutableString = (NSMutableString *)[mutableString stringByFoldingWithOptions:NSDiacriticInsensitiveSearch locale:[NSLocale currentLocale]];
//获取首字母, 并转成大写
NSString *firstLetter = [[mutableString substringToIndex:1] uppercaseString];//从0 开始到 某个位置
//uppercaseString转化成大写,lowercaseString转化成小写
时间: 2024-11-05 16:12:22