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
}
时间: 2024-10-23 16:47:41