增加字符串去空格方法
This commit is contained in:
parent
3529f2b113
commit
67e1cd1934
20
string.go
20
string.go
@ -157,3 +157,23 @@ func (s *stringOperate) Map2Query(data map[string]string) string {
|
|||||||
}
|
}
|
||||||
return strings.Join(list, "&")
|
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
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user