Automatically camel-case destination

This commit is contained in:
Kovid Goyal
2022-09-21 05:31:19 +05:30
parent 707963b694
commit 2ddbe2a2bc
3 changed files with 42 additions and 9 deletions

20
tools/utils/strings.go Normal file
View File

@@ -0,0 +1,20 @@
// License: GPLv3 Copyright: 2022, Kovid Goyal, <kovid at kovidgoyal.net>
package utils
import (
"fmt"
"strings"
"unicode/utf8"
)
var _ = fmt.Print
func Capitalize(x string) string {
if x == "" {
return x
}
s, sz := utf8.DecodeRuneInString(x)
cr := strings.ToUpper(string(s))
return cr + x[sz:]
}