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

 

posted @ 2018-04-08 10:59  川川籽  阅读(12304)  评论(0编辑  收藏  举报