mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 02:48:34 +08:00
18 lines
262 B
Go
18 lines
262 B
Go
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, "")
|
|
}
|