MCPcopy
hub / github.com/caddyserver/caddy / indexFold

Function indexFold

modules/caddyhttp/fileserver/matcher.go:596–604  ·  view source on GitHub ↗

There is no strings.IndexFold() function like there is strings.EqualFold(), but we can use strings.EqualFold() to build our own case-insensitive substring search (as of Go 1.14).

(haystack, needle string)

Source from the content-addressed store, hash-verified

594// but we can use strings.EqualFold() to build our own case-insensitive
595// substring search (as of Go 1.14).
596func indexFold(haystack, needle string) int {
597 nlen := len(needle)
598 for i := 0; i+nlen < len(haystack); i++ {
599 if strings.EqualFold(haystack[i:i+nlen], needle) {
600 return i
601 }
602 }
603 return -1
604}
605
606// isCELTryFilesLiteral returns whether the expression resolves to a map literal containing
607// only string keys with or a placeholder call.

Callers 1

firstSplitMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected