1 Star 0 Fork 0

nicole-go-libs/sql-to-struct-lib

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
words.go 471 Bytes
一键复制 编辑 原始数据 按行查看 历史
沿途风景 提交于 2022-11-28 15:33 +08:00 . add:init
package words
import (
"regexp"
"strings"
)
// ToBigCamelCase 大驼峰
func ToBigCamelCase(s string) string {
words := regexp.MustCompile("-|_").Split(s, -1)
for i, w := range words {
words[i] = strings.Title(w)
}
return strings.Join(words, "")
}
// ToCamelCase 小驼峰
func ToCamelCase(s string) string {
words := regexp.MustCompile("-|_").Split(s, -1)
for i, w := range words[1:] {
words[i+1] = strings.Title(w)
}
return strings.Join(words, "")
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/nicole-go-libs/sql-to-struct-lib.git
git@gitee.com:nicole-go-libs/sql-to-struct-lib.git
nicole-go-libs
sql-to-struct-lib
sql-to-struct-lib
v1.0.2

搜索帮助