1 Star 1 Fork 1

xiaoyutab / xgotool

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
camel_case.go 408 Bytes
一键复制 编辑 原始数据 按行查看 历史
xiaoyutab 提交于 2023-10-07 15:56 . 添加数据表模型的生成结构
package xstring
import "strings"
// 数据库表名转模型名【大驼峰转换】
// PS: 此函数会将abc_def的表名转换为AbcDef的大驼峰命名
//
// str 待转换的下划线命名的数据库表名称
func CamelCase(str string) string {
c := ""
// 目标切分
mbs := strings.Split(str, "_")
for i := 0; i < len(mbs); i++ {
c += strings.ToUpper(mbs[i][:1]) + mbs[i][1:]
}
return c
}
Go
1
https://gitee.com/xiaoyutab/xgotool.git
git@gitee.com:xiaoyutab/xgotool.git
xiaoyutab
xgotool
xgotool
v0.3.9

搜索帮助

53164aa7 5694891 3bd8fe86 5694891