How to convert string to unicode(UTF-8) string in Swift?

后端 未结 3 1976
终归单人心
终归单人心 2020-12-10 11:48

How to convert string to unicode(UTF-8) string in Swift?

In Objective I could write smth like that:

NSString *str = [[NSString alloc] initWithUTF8Str         


        
3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-10 12:19

    Swift 4:

    let str = String(describing: strToDecode.cString(using: String.Encoding.utf8))
    

提交回复
热议问题