#safe print byte

1 messages · Page 1 of 1 (latest)

cloud pasture
#

How safe print byte in zig?

Lets say I have byte \n, I don't print new line. I want to print \n.

usually encode string as json and print but I find that too much for printing a single byte.

manic pagoda
#

to print \n (backward slash, lowercase n), print the string "\\n"

cloud pasture
#

probably would make sense to print the byte as number but it's for a cool visualization I'm working on. just want to figure out to safe print.

manic pagoda
#

ah, I see what you're after, you want to print the escaped string. look into std.ascii.hexEscape

cloud pasture