From 8fd9d71625b2ce8c42cbd5eeccc8e19c5906ba22 Mon Sep 17 00:00:00 2001 From: Zorchenhimer Date: Sun, 14 Feb 2021 18:31:56 -0500 Subject: [PATCH] Add toCap() to capitalize the first letter of a string --- generic.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/generic.go b/generic.go index da1ea54..273e9cb 100644 --- a/generic.go +++ b/generic.go @@ -32,7 +32,7 @@ func (g *generic) Hack() (string, error) { //fmt.Printf("(%s) definite: %t; hasAdj: %t; plural: %t\n", np, definite, hasAdj, plural) sb := strings.Builder{} - sb.WriteString(np) + sb.WriteString(toCap(np)) ctime := models.CM_Present ctype := models.CT_I @@ -256,3 +256,7 @@ func ana(phrase string) string { return "a " + phrase } + +func toCap(words string) string { + return strings.ToUpper(string(words[0])) + words[1:] +}