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