go-tdlib/codegen/string.go

27 lines
460 B
Go
Raw Normal View History

2018-08-30 14:55:42 +00:00
package codegen
import (
2018-10-23 12:49:10 +00:00
"strings"
"unicode"
2018-08-30 14:55:42 +00:00
)
func firstUpper(str string) string {
2018-10-23 12:49:10 +00:00
for i, r := range str {
return string(unicode.ToUpper(r)) + str[i+1:]
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:49:10 +00:00
return str
2018-08-30 14:55:42 +00:00
}
func firstLower(str string) string {
2018-10-23 12:49:10 +00:00
for i, r := range str {
return string(unicode.ToLower(r)) + str[i+1:]
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:49:10 +00:00
return str
2018-08-30 14:55:42 +00:00
}
func underscoreToCamelCase(s string) string {
2018-10-23 12:49:10 +00:00
return strings.Replace(strings.Title(strings.Replace(strings.ToLower(s), "_", " ", -1)), " ", "", -1)
2018-08-30 14:55:42 +00:00
}