mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
add quote support for table named with '.'; improve case conversion for strings named with '.' for gstr
This commit is contained in:
@ -2,10 +2,10 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/gogf/gf/text/gregex"
|
||||
|
||||
"github.com/gogf/gf/text/gstr"
|
||||
)
|
||||
|
||||
func main() {
|
||||
file := "xxx/github.com/hg-hh/ww/gf/.example/"
|
||||
fmt.Println(gregex.IsMatchString(`/github.com/[^/]+/gf/\.example/`, file))
|
||||
fmt.Println(gstr.CamelCase("userLoginLog.bak"))
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
wordReg = regexp.MustCompile(`^[a-zA-Z0-9\-_]+$`)
|
||||
wordReg = regexp.MustCompile(`^[a-zA-Z0-9\-_\.]+$`)
|
||||
lastOperatorReg = regexp.MustCompile(`[<>=]+\s*$`)
|
||||
)
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ func DelimitedScreamingCase(s string, del uint8, screaming bool) string {
|
||||
} else if v >= 'a' && v <= 'z' {
|
||||
n += string(v) + string(del)
|
||||
}
|
||||
} else if v == ' ' || v == '_' || v == '-' {
|
||||
} else if v == ' ' || v == '_' || v == '-' || v == '.' {
|
||||
// replace spaces/underscores with delimiters
|
||||
n += string(del)
|
||||
} else {
|
||||
@ -132,7 +132,7 @@ func toCamelInitCase(s string, initCase bool) string {
|
||||
n += string(v)
|
||||
}
|
||||
}
|
||||
if v == '_' || v == ' ' || v == '-' {
|
||||
if v == '_' || v == ' ' || v == '-' || v == '.' {
|
||||
capNext = true
|
||||
} else {
|
||||
capNext = false
|
||||
|
||||
@ -20,6 +20,7 @@ func Test_CamelCase(t *testing.T) {
|
||||
{"test", "Test"},
|
||||
{"TestCase", "TestCase"},
|
||||
{" test case ", "TestCase"},
|
||||
{"userLogin_log.bak", "UserLoginLogBak"},
|
||||
{"", ""},
|
||||
{"many_many_words", "ManyManyWords"},
|
||||
{"AnyKind of_string", "AnyKindOfString"},
|
||||
|
||||
Reference in New Issue
Block a user