GetLeadingWhitespace returns the leading whitespace of the given byte array
(b []byte)
| 498 | |
| 499 | // GetLeadingWhitespace returns the leading whitespace of the given byte array |
| 500 | func GetLeadingWhitespace(b []byte) []byte { |
| 501 | ws := []byte{} |
| 502 | for len(b) > 0 { |
| 503 | r, _, size := DecodeCharacter(b) |
| 504 | if r == ' ' || r == '\t' { |
| 505 | ws = append(ws, byte(r)) |
| 506 | } else { |
| 507 | break |
| 508 | } |
| 509 | |
| 510 | b = b[size:] |
| 511 | } |
| 512 | return ws |
| 513 | } |
| 514 | |
| 515 | // GetTrailingWhitespace returns the trailing whitespace of the given byte array |
| 516 | func GetTrailingWhitespace(b []byte) []byte { |
no test coverage detected