2 Star 15 Fork 10

北京小程科技有限公司/Go通用工具

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
byte_array.go 298 Bytes
Copy Edit Raw Blame History
shallot authored 2021-12-05 13:05 +08:00 . 添加ByteArrayNoZeroString方法。
package transfer
import (
"bytes"
)
// 定长数组去掉多余的0后转字符串,先将定长数组转为切片后传入
func ByteArrayNoZeroString(arr []byte) (rst string) {
idx := bytes.IndexByte(arr, 0)
if idx >= 0 {
rst = string(arr[:idx])
} else {
rst = string(arr)
}
return
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/xiaochengtech/common.git
git@gitee.com:xiaochengtech/common.git
xiaochengtech
common
Go通用工具
82269be32710

Search