From b4b3e261e0c443279dcac588468bd15b7c0b918d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Fri, 13 Jan 2023 17:59:43 +0800 Subject: [PATCH] update --- string.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/string.go b/string.go index 25f639e..d62cb1a 100644 --- a/string.go +++ b/string.go @@ -158,21 +158,16 @@ func (s *stringOperate) Map2Query(data map[string]string) string { return strings.Join(list, "&") } -// ClearSpace 清理空格 +// ClearChar 清理指定字符 // // Author : go_developer@163.com<白茶清欢> // // Date : 16:53 2023/1/13 -func (s *stringOperate) ClearSpace(src string, spaceList ...string) string { - if len(spaceList) == 0 { - spaceList = []string{ - " ", - "\r", - "\n", - "\t", - } +func (s *stringOperate) ClearChar(src string, charList ...string) string { + if len(charList) == 0 { + return src } - for _, item := range spaceList { + for _, item := range charList { src = strings.ReplaceAll(src, item, "") } return src