Add toCap() to capitalize the first letter of a string

This commit is contained in:
Zorchenhimer 2021-02-14 18:31:56 -05:00
parent 9efa2cbe8c
commit 8fd9d71625
Signed by: Zorchenhimer
GPG Key ID: 70A1AB767AAB9C20
1 changed files with 5 additions and 1 deletions

View File

@ -32,7 +32,7 @@ func (g *generic) Hack() (string, error) {
//fmt.Printf("(%s) definite: %t; hasAdj: %t; plural: %t\n", np, definite, hasAdj, plural) //fmt.Printf("(%s) definite: %t; hasAdj: %t; plural: %t\n", np, definite, hasAdj, plural)
sb := strings.Builder{} sb := strings.Builder{}
sb.WriteString(np) sb.WriteString(toCap(np))
ctime := models.CM_Present ctime := models.CM_Present
ctype := models.CT_I ctype := models.CT_I
@ -256,3 +256,7 @@ func ana(phrase string) string {
return "a " + phrase return "a " + phrase
} }
func toCap(words string) string {
return strings.ToUpper(string(words[0])) + words[1:]
}