I have the following hex data: 0xB01B; its 45083 as uint16; how do I convert this to uint16 in go?
如何在go中将[] byte数据转换为uint16?
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
duanmao1872 2016-06-09 19:27关注Use the
encoding/binarypackage:import ( "encoding/binary" ) data := []byte{0xB0, 0x1B} val := binary.BigEndian.Uint16(data)本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报