go-json/decode_context.go

24 lines
365 B
Go
Raw Normal View History

2020-04-23 19:39:20 +03:00
package json
var (
isWhiteSpace = [256]bool{}
)
func init() {
isWhiteSpace[' '] = true
isWhiteSpace['\n'] = true
isWhiteSpace['\t'] = true
isWhiteSpace['\r'] = true
}
2020-05-06 20:37:29 +03:00
func skipWhiteSpace(buf []byte, cursor int) int {
buflen := len(buf)
for ; cursor < buflen; cursor++ {
if isWhiteSpace[buf[cursor]] {
2020-04-23 19:39:20 +03:00
continue
}
return cursor
}
return buflen
}