about summary refs log tree commit diff stats
path: root/src/utils
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-08-04 21:39:16 +0200
committerbptato <nincsnevem662@gmail.com>2022-08-04 21:39:16 +0200
commite7ea9c408667a4fdfefc369e51d72c3cfb9c1ee9 (patch)
tree45847ebb77cab10981fa0b47b9cff6f8a3fcd0a5 /src/utils
parent7f537f7991c384fd88fb1fecf6aa5c05edb6baee (diff)
downloadchawan-e7ea9c408667a4fdfefc369e51d72c3cfb9c1ee9.tar.gz
Remove httpclient dependency
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/twtstr.nim8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim
index 63d9a730..861edd48 100644
--- a/src/utils/twtstr.nim
+++ b/src/utils/twtstr.nim
@@ -120,6 +120,14 @@ func toAsciiLower*(str: string): string =
   for i in 0..str.high:
     result[i] = str[i].tolower()
 
+func toHeaderCase*(str: string): string =
+  result = str
+  var flip = true
+  for i in 0..str.high:
+    if flip:
+      result[i] = result[i].toUpperAscii()
+    flip = result[i] == '-'
+
 func startsWithNoCase*(str, prefix: string): bool =
   if str.len < prefix.len: return false
   # prefix.len is always lower