MCPcopy Create free account
hub / github.com/imroc/req / trim

Function trim

textproto_reader.go:107–117  ·  view source on GitHub ↗

trim returns s with leading and trailing spaces and tabs removed. It does not assume Unicode or UTF-8.

(s []byte)

Source from the content-addressed store, hash-verified

105// trim returns s with leading and trailing spaces and tabs removed.
106// It does not assume Unicode or UTF-8.
107func 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

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…