How to convert uint8 to string

后端 未结 5 1234
感动是毒
感动是毒 2020-11-27 08:10

http://play.golang.org/p/BoZkHC8_uA

I want to convert uint8 to string but can\'t figure out how.

  package main

  import \"fmt\"
  import \"strconv\         


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-27 08:29

    You can do it even simpler by using casting, this worked for me:

    var c uint8
    c = 't'
    fmt.Printf(string(c))
    

提交回复
热议问题