增加常见的中文字符替换成英文
This commit is contained in:
parent
32f50cce5b
commit
812faa2e21
21
string.go
21
string.go
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user