import strutils
var s = "a\0b\0c"
echo s.replace("\0", "\\0")
echo s.replace("\0", "")
echo s.repr
for c in s: write(stdout, c)
write(stdout, "\n")
proc stringToHex(s: string): string =
result = ""
for o,c in s:
if o != 0:
result.add ' '
result.add c.int.toHex(2)
echo s.stringToHex