diff options
author | rsiddharth <s@ricketyspace.net> | 2021-01-27 22:22:20 -0500 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2021-01-27 22:22:20 -0500 |
commit | 4b68263ea32cab3ecc70575c257de407fa703f07 (patch) | |
tree | 43633b7d7f4fc0c9a9d3cd90eb1c4e51b8c74880 | |
parent | aaeb94873e7b9c9e5b79d44be6f5a727596b6f97 (diff) |
lib: add StrToUpper
-rw-r--r-- | lib/str.go | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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 +} |