// String转UTF8
let testStr = "212 212"
let testData = testStr.dataUsingEncoding(NSUTF8StringEncoding)
// UTF8转String
let dogString:String = (NSString(data: testData!, encoding: NSUTF8StringEncoding))! as String
// String转UTF8
let testStr = "212 212"
let testData = testStr.dataUsingEncoding(NSUTF8StringEncoding)
// UTF8转String
let dogString:String = (NSString(data: testData!, encoding: NSUTF8StringEncoding))! as String
本文标题:Swift: String与UTF8
本文链接:https://www.haomeiwen.com/subject/jozrpltx.html
网友评论