From 4b68263ea32cab3ecc70575c257de407fa703f07 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Wed, 27 Jan 2021 22:22:20 -0500 Subject: lib: add StrToUpper --- lib/str.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/str.go') diff --git a/lib/str.go b/lib/str.go index c93ca12..98b16e9 100644 --- a/lib/str.go +++ b/lib/str.go @@ -116,3 +116,15 @@ func StrSplitAt(c byte, s string) []string { } return l } + +func StrToUpper(s string) string { + us := "" + for i := 0; i < len(s); i++ { + if 'a' <= s[i] && s[i] <= 'z' { + us += string('A' + (s[i] - 'a')) + } else { + us += string(s[i]) + } + } + return us +} -- cgit v1.2.3