func convertHalfFromString(fullStr: String) -> String{ let srcStr = fullStr.stringByReplacingOccurrencesOfString("。",withString: ".") let cfstr = NSMutableString(string: String(srcStr)) as CFMutableString var range = CFRangeMake(0,CFStringGetLength(cfstr)) CFStringTransform(cfstr,&range,kcfStringTransformFullwidthHalfwidth,Bool(0)) return cfstr as String }IOS开发 全角转换半角 原文链接:https://www.f2er.com/swift/320874.html