diff options
Diffstat (limited to 'modules/util/util.go')
-rw-r--r-- | modules/util/util.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/util/util.go b/modules/util/util.go index af6581f7cd..351a345473 100644 --- a/modules/util/util.go +++ b/modules/util/util.go @@ -11,6 +11,9 @@ import ( "math/big" "strconv" "strings" + + "golang.org/x/text/cases" + "golang.org/x/text/language" ) // OptionalBool a boolean that can be "null" @@ -181,3 +184,10 @@ func ToUpperASCII(s string) string { } return string(b) } + +var titleCaser = cases.Title(language.English) + +// ToTitleCase returns s with all english words capitalized +func ToTitleCase(s string) string { + return titleCaser.String(s) +} |