kCFStringTransformStripDiacritics 純拼音
這裡我寫一個方法,將需要轉換的字符串輸入就行了
具體為
NSString *string = @"中文"; NSString *text = [self stringWithForChainese:string];
- (NSString *)stringWithForChainese:(NSString *)text { CFStringTransform((__bridge CFMutableStringRef)text, 0, kCFStringTransformStripDiacritics, NO); return text; }