增加常见的中文字符替换成英文

This commit is contained in:
白茶清欢 2023-04-04 17:01:46 +08:00
parent 32f50cce5b
commit 812faa2e21

View File

@ -172,3 +172,24 @@ func (s *stringOperate) ClearChar(src string, charList ...string) string {
}
return src
}
// ReplaceChineseChar 替换常见的中文符号
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 16:59 2023/4/4
func (s *stringOperate) ReplaceChineseChar(str string) string {
charTable := map[string]string{
"": "(",
"": ")",
"": ":",
"": ",",
"。": ".",
"【": "]",
"】": "]",
}
for k, v := range charTable {
str = strings.ReplaceAll(str, k, v)
}
return str
}