summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2021-01-27 22:22:20 -0500
committerrsiddharth <s@ricketyspace.net>2021-01-27 22:22:20 -0500
commit4b68263ea32cab3ecc70575c257de407fa703f07 (patch)
tree43633b7d7f4fc0c9a9d3cd90eb1c4e51b8c74880 /lib
parentaaeb94873e7b9c9e5b79d44be6f5a727596b6f97 (diff)
lib: add StrToUpper
Diffstat (limited to 'lib')
-rw-r--r--lib/str.go12
1 files changed, 12 insertions, 0 deletions
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
+}