NimYAML/yaml/private/escaping.nim

10 lines
265 B
Nim
Raw Normal View History

2020-11-10 18:07:46 +00:00
proc yamlTestSuiteEscape*(s: string): string =
result = ""
for c in s:
case c
of '\l': result.add("\\n")
of '\c': result.add("\\r")
of '\\': result.add("\\\\")
of '\b': result.add("\\b")
of '\t': result.add("\\t")
else: result.add(c)