If a string contains a ~, I can't seem to print that to standard out.
> A = "/.git".
> io:fwrite(A).
/.gitok
> B = "~/.git".
> io:fwrite(B).
** exception error: bad argument
in function io:format/3
called as io:format(<0.50.0>,"~/.git",[])
How can I print a string with tildes to standard out?
If a string contains a
~, I can't seem to print that to standard out.
To format output, you construct a string containing format sequences that start with a ~. Erlang thinks your string contains a format sequence. If you want Erlang to output a literal ~, you can escape it with another ~:
22> io:format("~~/.git~n").
~/.git
ok
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With