about summary refs log tree commit diff stats
path: root/src/utils/twtstr.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-10-27 00:01:52 +0200
committerbptato <nincsnevem662@gmail.com>2023-10-27 00:03:05 +0200
commit6efa186973b01cfaea0e3f6a5bbfca1a2cdd7f66 (patch)
tree5beb23b567f4d851cac1db89f8474c6346d77ef4 /src/utils/twtstr.nim
parent2f627f0d7aaf3dd0c44ef3aeb30ec33948a2786d (diff)
downloadchawan-6efa186973b01cfaea0e3f6a5bbfca1a2cdd7f66.tar.gz
Add -C option
Diffstat (limited to 'src/utils/twtstr.nim')
-rw-r--r--src/utils/twtstr.nim7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim
index f8557a85..327fae81 100644
--- a/src/utils/twtstr.nim
+++ b/src/utils/twtstr.nim
@@ -563,6 +563,13 @@ func htmlEscape*(s: string): string =
       res &= c
   return res
 
+func dqEscape*(s: string): string =
+  result = newStringOfCap(s.len)
+  for c in s:
+    if c == '"':
+      result &= '\\'
+    result &= c
+
 #basically std join but with char
 func join*(ss: openarray[string], sep: char): string =
   if ss.len == 0: