码迷,mamicode.com
首页 > 其他好文 > 详细

中文转拼音

时间:2015-12-14 16:09:24      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:

- (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;
 }

 

中文转拼音

标签:

原文地址:http://www.cnblogs.com/fs-ios/p/5045137.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!