From 812faa2e21979b7cf3f149d9c3e093fc52f84876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Tue, 4 Apr 2023 17:01:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B8=B8=E8=A7=81=E7=9A=84?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E5=AD=97=E7=AC=A6=E6=9B=BF=E6=8D=A2=E6=88=90?= =?UTF-8?q?=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- string.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/string.go b/string.go index d62cb1a..de97f97 100644 --- a/string.go +++ b/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 +}