美文网首页
Swift: String与UTF8

Swift: String与UTF8

作者: ChaosHeart | 来源:发表于2021-08-10 09:15 被阅读0次

    // 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