码迷,mamicode.com
首页 > 编程语言 > 详细

swift

时间:2016-09-23 23:26:01      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:

1.汉字转拼音

func pinYinZChines(content:String)->String{
     
    let transformContents = CFStringCreateMutableCopy(nil, 0, content)
     
    CFStringTransform( transformContents, nil, kCFStringTransformMandarinLatin, false)
     
    CFStringTransform( transformContents, nil, kCFStringTransformStripDiacritics, false)
     
    let ztransformContents = transformContents as String
     
    let index = ztransformContents.startIndex.advancedBy(0)
     
    let firstString = ztransformContents[index]
     
    let stringZ = String.init(firstString)
     
    return stringZ.uppercaseString
     
}

swift

标签:

原文地址:http://www.cnblogs.com/starainDou/p/5901860.html

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