September 2013
Intermediate to advanced
548 pages
12h 25m
English
Within strings and quoted atoms, you can use escape sequences to enter any nonprintable characters. All the possible escape sequences are shown in Table 4, Escape sequences.
Let’s give some examples in the shell to show how these
conventions work. (Note: ~w in a format string prints
the list without any attempt to pretty print the result.)
| | %% Control characters |
| | 1> io:format("~w~n", ["\b\d\e\f\n\r\s\t\v"]). |
| | [8,127,27,12,10,13,32,9,11] |
| | ok |
| | %% Octal characters in a string |
| | 2> io:format("~w~n", ["\123\12\1"]). |
| | [83,10,1] |
| | ok |
| | %% Quotes and escapes in a string |
| | 3> io:format("~w~n", ["\'\"\\"]). |
| | [39,34,92] |
| | ok |
| | %% Character codes |
| | 4> io:format("~w~n", ["\a\z\A\Z"]). |
| | [97,122,65,90] |
| | ok |
Read now
Unlock full access