From 67e1cd1934a734ea824b2871f76bdac6f4d8d4a5 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 16:56:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AD=97=E7=AC=A6=E4=B8=B2?= =?UTF-8?q?=E5=8E=BB=E7=A9=BA=E6=A0=BC=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- string.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 +}