MCPcopy Create free account
hub / github.com/brimdata/super / StringContainsFold

Function StringContainsFold

runtime/sam/expr/filter.go:54–71  ·  view source on GitHub ↗

StringContainsFold is like strings.Contains but with case-insensitive comparison.

(a, b string)

Source from the content-addressed store, hash-verified

52// StringContainsFold is like strings.Contains but with case-insensitive
53// comparison.
54func StringContainsFold(a, b string) bool {
55 alen := len(a)
56 blen := len(b)
57
58 if blen > alen {
59 return false
60 }
61
62 end := alen - blen + 1
63 i := 0
64 for i < end {
65 if strings.EqualFold(a[i:i+blen], b) {
66 return true
67 }
68 i++
69 }
70 return false
71}
72
73var errMatch = errors.New("match")
74

Callers 5

NewSearchFunction · 0.92
NewSearchStringFunction · 0.92
EvalMethod · 0.85
NewSearchStringFunction · 0.85
EvalMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected