mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-28 12:21:55 +00:00
Automatically camel-case destination
This commit is contained in:
parent
707963b694
commit
2ddbe2a2bc
3 changed files with 42 additions and 9 deletions
20
tools/utils/strings.go
Normal file
20
tools/utils/strings.go
Normal 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:]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue