Control Characters
| Sequence | Hex-Code | Description |
|---|---|---|
| \r | 0x0D | Carriage Return (CR) - Return to beginning of line |
| \n | 0x0A | Line Feed (LF) - Go to next line |
| \f | 0x0C | Form Feed (FF) - Same effect as LF |
| \b | 0x08 | Backspace (BS) - Go back one character |
| \t | 0x09 | Horizontal Tab (HT) - Go to next tabulator position |
| \u001B | 0x1B | Escape (ESC) - Start of ANSI sequence |
Example
Draw.writeText("Hello \t World!");
Attribute Sequences
| Sequence | Description |
|---|---|
| \u001B [ m | Set bold, underline and inverse mode off |
| \u001B [ 0 m | Set bold, underline and inverse mode off |
| \u001B [ 1 m | Set bold mode on |
| \u001B [ 4 m | Set underline mode on |
| \u001B [ 7 m | Set invert mode on |
Example
Draw.writeText("Only the expression " + "\u001B[4m" + "hello" + "\u001B[m" + " is underlined.");
Display Control Sequences
| Sequence | Description |
|---|---|
| \u001B [ 2 J | Clear Display |
| \u001B [ K | Erase to end of line |
| \u001B [ 0 K | Erase to end of line |
Example
Draw.writeText("\u001B[2J");
Cursor Control Sequences
| Sequence | Description |
|---|---|
| \u001B [ <n> A | Cursor up <n> rows |
| \u001B [ <n> B | Cursor down <n> rows |
| \u001B [ <n> C | Cursor right <n> columns |
| \u001B [ <n> D | Cursor left <n> columns |
| \u001B [ <x> ; <y> H | Go to <x> <y> position |
| \u001B [ <x> ; <y> f | Go to <x> <y> position |
| \u001B [ H | Go to home (set cursor to x=0 / y=0) |
| \u001B [ f | Go to home (set cursor to x=0 / y=0) |
Example
Draw.writeText("\u001B[1A");
Please note, that <x> <y> is used in the opposite order to that in standard ANSI sequences.
Save Restore Sequences
| Sequence | Description |
|---|---|
| \u001B [ <n> s | Save cursor & attributes to memory position <n> (0 ... 7) |
| \u001B [ s | Save cursor & attributes to memory position 0 |
| \u001B [ <n> u | Restore cursor & attributes from memory position <n> (0 ... 7) |
| \u001B [ u | Restore cursor & attributes from memory position 0 |
Example
Draw.writeText("\u001B[s");
See also:
Copyright © demmel products gmbh. All rights reserved.