首页 > 技术文章 > golang "[]uint8" to string

yzhch 2018-04-08 10:59 原文

 

关于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

 

推荐阅读