Escaping special characters
Problem
You want to print special characters, like a newline.
Using a regular string quotes like 'foo\nfoo' will not convert the \n to a newline character; you'll just get a \ and an n.
Solution
To print special characters such as those listed in the table below, use the sprintf() function.
| tab | \t |
| newline | \n |
| backslash | \\ |
| percent | %% |
sprintf('before tab\tafter tab') % before tab after tab sprintf('first line\nsecond line') % first line % second line sprintf('backslash: \\') % backslash: \ sprintf('percent: %%') % percent: %