MCPcopy Index your code
hub / github.com/coder/coder / normalizeQuery

Function normalizeQuery

agent/filefinder/text.go:12–35  ·  view source on GitHub ↗
(q string)

Source from the content-addressed store, hash-verified

10}
11
12func normalizeQuery(q string) string {
13 b := make([]byte, 0, len(q))
14 prevSpace := true
15 for i := 0; i < len(q); i++ {
16 c := q[i]
17 if c == '\\' {
18 c = '/'
19 }
20 c = toLowerASCII(c)
21 if c == ' ' {
22 if prevSpace {
23 continue
24 }
25 prevSpace = true
26 } else {
27 prevSpace = false
28 }
29 b = append(b, c)
30 }
31 if len(b) > 0 && b[len(b)-1] == ' ' {
32 b = b[:len(b)-1]
33 }
34 return string(b)
35}
36
37func normalizePathBytes(p []byte) []byte {
38 j := 0

Callers 1

newQueryPlanFunction · 0.85

Calls 1

toLowerASCIIFunction · 0.85

Tested by

no test coverage detected