diff options
author | bptato <nincsnevem662@gmail.com> | 2023-09-18 20:37:36 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-09-18 20:37:36 +0200 |
commit | 8a826ba92b7c744a995a9593834d63acd6d040b3 (patch) | |
tree | 2b808d8df3d2a0a0994a28b6fd96bc073ad4a24b /src/utils/twtstr.nim | |
parent | 2f8edaffdcf22b90389d214b730ea9e28a3b2e5a (diff) | |
download | chawan-8a826ba92b7c744a995a9593834d63acd6d040b3.tar.gz |
term: simplify/cleanup
Diffstat (limited to 'src/utils/twtstr.nim')
-rw-r--r-- | src/utils/twtstr.nim | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim index c0b68178..7589c262 100644 --- a/src/utils/twtstr.nim +++ b/src/utils/twtstr.nim @@ -1071,6 +1071,15 @@ func deleteChars*(s: string, todel: set[char]): string = inc i return rs +func replaceControls*(s: string): string = + result = newStringOfCap(s.len) + for c in s: + if c in Controls: + result &= '^' + result &= c.getControlLetter() + else: + result &= c + #https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart/form-data-encoding-algorithm proc makeCRLF*(s: string): string = result = newStringOfCap(s.len) |