From e6868fabd2db28add157e495ed0ac0e3251fe5bb Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Thu, 20 Jul 2023 20:20:36 +0100 Subject: [PATCH] Do not convert string to string --- src/preserves.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/preserves.nim b/src/preserves.nim index 9b22bbf..cfcda1b 100644 --- a/src/preserves.nim +++ b/src/preserves.nim @@ -34,12 +34,12 @@ proc len*(s: Symbol): int {.borrow.} proc `$`*(s: Symbol): string = let sym = string s - if sym.len > 0 and sym.string[0] in {'A'..'z'} and not sym.anyIt(char(it) in { '\x00'..'\x19', '"', '\\', '|' }): - result = string sym + if sym.len > 0 and sym[0] in {'A'..'z'} and not sym.anyIt(char(it) in { '\x00'..'\x19', '"', '\\', '|' }): + result = sym else: result = newStringOfCap(sym.len shl 1) result.add('|') - for c in sym.string: + for c in sym: case c of '\\': result.add("\\\\")