Function call can be replaced with helper function CRT-A0010
Anti-pattern
Major
5 months ago4 years old
use strings.ReplaceAll method in strings.Replace(str, "\x1b", "", -1)
846}
847
848func cleanse(str string) string {
849	return strings.Replace(str, "\x1b", "", -1)850}
851
852func (w *LightWindow) CPrint(pair ColorPair, attr Attr, text string) {
use strings.ReplaceAll method in strings.Replace(entry, "'", "'\\''", -1)
1213	if util.IsWindows() {
1214		return quoteEntryCmd(entry)
1215	}
1216	return "'" + strings.Replace(entry, "'", "'\\''", -1) + "'"1217}
1218
1219func parsePlaceholder(match string) (bool, string, placeholderFlags) {
use strings.ReplaceAll method in strings.Replace(escaped, ", \", -1)
1202
1203func quoteEntryCmd(entry string) string {
1204	escaped := strings.Replace(entry, `\`, `\\`, -1)
1205	escaped = `"` + strings.Replace(escaped, `"`, `\"`, -1) + `"`1206	r, _ := regexp.Compile(`[&|<>()@^%!"]`)
1207	return r.ReplaceAllStringFunc(escaped, func(match string) string {
1208		return "^" + match
use strings.ReplaceAll method in strings.Replace(entry, \, \\, -1)
1201}
1202
1203func quoteEntryCmd(entry string) string {
1204	escaped := strings.Replace(entry, `\`, `\\`, -1)1205	escaped = `"` + strings.Replace(escaped, `"`, `\"`, -1) + `"`
1206	r, _ := regexp.Compile(`[&|<>()@^%!"]`)
1207	return r.ReplaceAllStringFunc(escaped, func(match string) string {
use strings.ReplaceAll method in strings.Replace(query, "\t", " ", -1)
 315}
 316
 317func trimQuery(query string) []rune {
 318	return []rune(strings.Replace(query, "\t", " ", -1)) 319}
 320
 321// NewTerminal returns new Terminal object