trim returns s with leading and trailing spaces and tabs removed. It does not assume Unicode or UTF-8.
(s []byte)
| 105 | // trim returns s with leading and trailing spaces and tabs removed. |
| 106 | // It does not assume Unicode or UTF-8. |
| 107 | func trim(s []byte) []byte { |
| 108 | i := 0 |
| 109 | for i < len(s) && (s[i] == ' ' || s[i] == '\t') { |
| 110 | i++ |
| 111 | } |
| 112 | n := len(s) |
| 113 | for n > i && (s[n-1] == ' ' || s[n-1] == '\t') { |
| 114 | n-- |
| 115 | } |
| 116 | return s[i:n] |
| 117 | } |
| 118 | |
| 119 | // readContinuedLineSlice reads continued lines from the reader buffer, |
| 120 | // returning a byte slice with all lines. The validateFirstLine function |
no outgoing calls
no test coverage detected
searching dependent graphs…