go-rfc2396/port/bytes.go

30 lines
361 B
Go
Raw Normal View History

2023-12-08 06:27:49 +00:00
package port
import (
"sourcecode.social/reiver/go-rfc2396/digit"
)
func Bytes(p []byte) ([]byte, []byte, bool) {
length := len(p)
if length <= 0 {
return nil, nil, true
}
{
p0 := p[0]
if !digit.ByteIs(p0) {
return nil, p, true
}
}
for i,b := range p {
if !digit.ByteIs(b) {
return p[:i], p[i:], true
}
}
return p, nil, true
}