package dbx import "strings" // StringToFilter processes a string to be used as a filter in an SQL LIKE // statement. It replaces all spaces with % and adds % to the beginning and // end of the string. func StringToFilter(str string) string { str = strings.Trim(str, "%") str = strings.ReplaceAll(str, " ", "%") str = "%" + str + "%" return str }