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