Using Special Characters
Organize data with line breaks and tabs by using special characters in text strings.
When writing JavaScript for Acrobat programs and forms there are special characters that can be inserted into text strings to separate and organize parts of the string. These characters must be "escaped" in the string, that is, preceded by a backslash. The backslash lets the JavaScript engine know that the next character is a special character. In this post I will be examining three of these special characters.
\r - A backslash followed by a lower case r signifies a carriage return (a new line).
\n - A backslash followed by a lower case n signifies a new line. It is very similar to the carriage return but does not act exactly the same.
\t - A backslash followed by a lower case t signifies a tab.
Try running these scripts in the console:
//Script 1
"The quick brown fox\rjumped over the lazy dogs."
//Script 2
"The quick brown fox\njumped over the lazy dogs."
//Script 3
"The\tquick\tbrown\tfox"
//Script 4
"The\tquick\tbrown\nfox\tjumped\tover\rthe\tlazy\tdogs."