package functions import "strings" // check if string is empty or contains only whitespaces func OnlyWhitespace(word string) bool { if len(strings.TrimSpace(word)) == 0 { return true } return false } func Contains(s []string, e string) bool { for _, a := range s { if a == e { return true } } return false } func ReplaceEmptyString(word string, replacement string) string { if OnlyWhitespace(word) { return replacement } return word }