From 4b6f773e06845c39b4737725b3b1b60c3e50f0ad Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Wed, 20 Sep 2023 10:25:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/string.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/utils/string.go b/utils/string.go index aba3e94..585b55a 100644 --- a/utils/string.go +++ b/utils/string.go @@ -212,7 +212,9 @@ func KsortToStr(params map[string]string) []string { return keys } func UderscoreToUpperCamelCase(s string) string { - s = strings.Replace(s, "_", " ", -1) - s = strings.Title(s) - return strings.Replace(s, " ", "", -1) + split := strings.Split(s, "_") + if len(split) == 2 { + s = split[0] + strings.Title(split[1]) + } + return s }