diff --git a/string.go b/string.go index 83282da..972d10b 100644 --- a/string.go +++ b/string.go @@ -157,3 +157,23 @@ func (s *stringOperate) Map2Query(data map[string]string) string { } return strings.Join(list, "&") } + +// ClearSpace 清理空格 +// +// 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`, + } + } + for _, item := range spaceList { + src = strings.ReplaceAll(src, item, "") + } + return src +}