Source File
underscore.go
Belonging Package
github.com/uptrace/bun/internal
package internalfunc ( byte) bool {return >= 'A' && <= 'Z'}func ( byte) bool {return >= 'a' && <= 'z'}func ( byte) byte {return - 32}func ( byte) byte {return + 32}// Underscore converts "CamelCasedString" to "camel_cased_string".func ( string) string {:= make([]byte, 0, len()+5)for := 0; < len(); ++ {:= []if IsUpper() {if > 0 && +1 < len() && (IsLower([-1]) || IsLower([+1])) {= append(, '_', ToLower())} else {= append(, ToLower())}} else {= append(, )}}return string()}func ( string) string {:= make([]byte, 0, len()):= truefor := 0; < len(); ++ {:= []if == '_' {= truecontinue}if {if IsLower() {= ToUpper()}= false}= append(, )}return string()}func ( string) string {if len() == 0 {return}if := [0]; IsLower() {:= []byte()[0] = ToUpper()return string()}return}
![]() |
The pages are generated with Golds v0.3.6. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |