小编ida*_*dov的帖子

bytes.Split 分隔符为 []byte("...")

bytes_test.go中我看到:

 a := Split([]byte(tt.s), []byte(tt.sep), tt.n)
Run Code Online (Sandbox Code Playgroud)

其中 tt.s 和 tt.sep 是字符串。但是当我尝试做的时候

 a := bytes.Split([]byte("test"), []byte("e"), 0)
Run Code Online (Sandbox Code Playgroud)

我得到:

 cannot convert "test" (type ideal string) to type []uint8 in conversion
 cannot convert "e" (type ideal string) to type []uint8 in conversion
Run Code Online (Sandbox Code Playgroud)

string byte types go

2
推荐指数
1
解决办法
6785
查看次数

标签 统计

byte ×1

go ×1

string ×1

types ×1