How to convert UInt8 byte array to string in Swift

前端 未结 14 2528
野的像风
野的像风 2020-12-05 06:29

I am facing problems while converting UInt8 Byte array to string in swift. I have searched and find a simple solution

String.stringWithBytes(buf         


        
14条回答
  •  一生所求
    2020-12-05 07:00

    This solution works.

    NSString(bytes: data!, length: data!.count, encoding: NSUTF8StringEncoding) 
    

提交回复
热议问题