我只想在不诉诸strconv& amp;字符串,但我不熟练只用字节工作:
func rangeSeq(b *bytes.Buffer) ([][]byte, bool) {
q := bytes.Split(b.Bytes(), []byte{SEQ_RANGE})
if len(q) == 2 {
var ret [][]byte
il, lt := string(q[0]), string(q[1])
initial, err := strconv.ParseInt(il, 10, 64)
last, err := strconv.ParseInt(lt, 10, 64)
if err == nil {
if initial < last {
for i := initial; i <= last; i++ {
out := strconv.AppendInt([]byte{}, i, 10)
ret = append(ret, out)
}
}
return ret, true
}
}
return nil, false
}
建议?