golang "[]uint8" to string


 

关于Uinit8和Byte:

The Go Programming Language Specification Numeric types

uint8 the set of all unsigned 8-bit integers (0 to 255)

byte alias for uint8

 

将[]uinit8转换为string:

func B2S(bs []int8) string {
  ba := []byte{}
  for _, b := range bs {
    ba = append(ba, byte(b))
  }
  return string(ba)
}

 

参考文章:

https://blog.csdn.net/pingD/article/details/76588648

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM