let testStr = "212 212"
let testData = testStr.dataUsingEncoding(NSUTF8StringEncoding) // String转UTF8
let dogString:String = (NSString(data: testData!, encoding: NSUTF8StringEncoding))! as String // UTF8转String
print(testData)
print(dogString)
Swift中String和UTF8编码的NSData相互转化
最新推荐文章于 2024-04-05 20:41:13 发布