INNER CODE UNIT · Go

filterContains

wgpsec/cloudsword · cmd/modules.go:227

func filterContains(suggestions []prompt.Suggest, word string, ignoreCase bool) []prompt.Suggest {
	if len(word) == 0 {
		return suggestions
	}
	filtered := make([]prompt.Suggest, 0, len(suggestions))
	for _, s := range suggestions {
		text := s.Text
		if ignoreCase {
			text = strings.ToLower(text)
			word = strings.ToLower(word)
		}
		if strings.Contains(text, word) {
			filtered = append(filtered, s)
		}
	}
	return filtered
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…