MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / ParseStringList

Function ParseStringList

internal/waf/values/string_list.go:22–47  ·  view source on GitHub ↗
(v string, caseInsensitive bool)

Source from the content-addressed store, hash-verified

20}
21
22func ParseStringList(v string, caseInsensitive bool) *StringList {
23 var list = NewStringList(caseInsensitive)
24 if len(v) == 0 {
25 return list
26 }
27
28 var lines = strings.Split(v, "\n")
29 for _, line := range lines {
30 line = strings.TrimSpace(line)
31 if len(line) == 0 {
32 continue
33 }
34
35 var values = strings.Split(line, ",")
36 for _, value := range values {
37 value = strings.TrimSpace(value)
38 if len(value) > 0 {
39 if caseInsensitive {
40 value = strings.ToLower(value)
41 }
42 list.ValueMap[value] = zero.Zero{}
43 }
44 }
45 }
46 return list
47}
48
49func (this *StringList) Contains(f string) bool {
50 if this.CaseInsensitive {

Callers 2

InitMethod · 0.92
TestParseStringListFunction · 0.92

Calls 1

NewStringListFunction · 0.85

Tested by 1

TestParseStringListFunction · 0.74