增加字符串去空格方法

This commit is contained in:
白茶清欢 2023-01-13 16:56:31 +08:00
parent 3529f2b113
commit 67e1cd1934

View File

@ -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
}