mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-05-12 14:52:07 +08:00
支持tdengine
This commit is contained in:
17
pkg/tool/base.go
Normal file
17
pkg/tool/base.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package tool
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func ToCamelCase(s string) string {
|
||||
re := regexp.MustCompile(`[_\W]+`)
|
||||
words := re.Split(s, -1)
|
||||
for i := range words {
|
||||
if i != 0 {
|
||||
words[i] = strings.Title(words[i])
|
||||
}
|
||||
}
|
||||
return strings.Join(words, "")
|
||||
}
|
||||
8
pkg/tool/base_test.go
Normal file
8
pkg/tool/base_test.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package tool
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestToCamelCase(t *testing.T) {
|
||||
camelCase := ToCamelCase("hello_world")
|
||||
t.Log(camelCase)
|
||||
}
|
||||
Reference in New Issue
Block a user