escaping.nim
1 # NimYAML - YAML implementation in Nim 2 # (c) Copyright 2015-2023 Felix Krause 3 # 4 # See the file "copying.txt", included in this 5 # distribution, for details about the copyright. 6 7 proc yamlTestSuiteEscape*(s: string): string = 8 result = "" 9 for c in s: 10 case c 11 of '\l': result.add("\\n") 12 of '\c': result.add("\\r") 13 of '\\': result.add("\\\\") 14 of '\b': result.add("\\b") 15 of '\t': result.add("\\t") 16 else: result.add(c)