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

Function ContainsAllWords

internal/utils/runes/runes.go:75–87  ·  view source on GitHub ↗

ContainsAllWords 检查字符串是否包含所有单词

(s string, words []string, isCaseInsensitive bool)

Source from the content-addressed store, hash-verified

73
74// ContainsAllWords 检查字符串是否包含所有单词
75func ContainsAllWords(s string, words []string, isCaseInsensitive bool) bool {
76 var allRunes = []rune(s)
77 if len(allRunes) == 0 || len(words) == 0 {
78 return false
79 }
80
81 for _, word := range words {
82 if result, _ := ContainsWordRunes(allRunes, []rune(word), isCaseInsensitive); !result {
83 return false
84 }
85 }
86 return true
87}
88
89// ContainsWordRunes 检查字符列表是否包含某个单词子字符列表
90func ContainsWordRunes(allRunes []rune, subRunes []rune, isCaseInsensitive bool) (result bool, firstIndex int) {

Callers 2

TestContainsAllWordsFunction · 0.92
TestMethod · 0.92

Calls 1

ContainsWordRunesFunction · 0.85

Tested by 1

TestContainsAllWordsFunction · 0.74