Description
You can include special ASCII characters in strings. For example, you might want to include a tab in a string to ensure proper spacing or a bullet to indicate a list item. The tilde character (~) introduces special characters. The tab is one of the common ASCII characters that can be entered by typing a tilde followed by a single keystroke. The bullet must be entered by typing a tilde followed by the decimal, hexadecimal, or octal ASCII value that represents it.
Syntax
Follow the guidelines in the following table.
In this category |
To specify this |
Enter this |
More information |
---|---|---|---|
Common ASCII characters |
Newline |
~n |
|
|
Tab |
~t |
|
|
Vertical tab |
~v |
|
|
Carriage return |
~r |
|
|
Form feed |
~f |
|
|
Backspace |
~b |
|
|
Double quote |
~" |
|
|
Single quote |
~' |
|
|
Tilde |
~~ |
|
Any ASCII character |
Decimal |
~### |
### = a 3-digit number from 000 to 255 |
|
Hexadecimal |
~h## |
## = a 2-digit hexadecimal number from 01 to FF |
|
Octal |
~o### |
### = a 3-digit octal number from 000 to 377 |
Examples
Entering ASCII characters
Here is how to use special characters in strings:
String |
Description |
---|---|
"dog~n" |
A string containing the word dog followed by a newline character |
"dog~tcat~ttiger" |
A string containing the word dog, a tab character, the word cat, another tab character, and the word tiger |
Using decimal, hexadecimal, and octal values
Here is how to indicate a bullet (*) in a string by using the decimal, hexadecimal, and octal ASCII values:
Value |
Description |
---|---|
"~249" |
The ASCII character with decimal value 249 |
"~hF9" |
The ASCII character with hexadecimal value F9 |
"~o371" |
The ASCII character with octal value 371 |