Do not convert string to string
This commit is contained in:
parent
81d04290a5
commit
e6868fabd2
|
@ -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("\\\\")
|
||||
|
|
Loading…
Reference in New Issue