What is the purpose of the Unicode Character 'BACKSPACE' (U+0008) in programming? What applications can it be used for?
On output to a terminal, it typically moves the cursor one position to the left (depending on settings). On input, it typically erases the last entered character (depending on the application and terminal settings), though the DEL / DELETE character is also used for this purpose. Typically it can be entered by pressing Backspace or Control-H
Note that its action of deleting characters occurs only on a display, not in memory. A string within a running program can contain just about any sequence of characters (depending perhaps on the language), including backspace. In that context, it's generally just another character. For example, in C strlen("abcd\b")
is 5, not 3.
In C and a number of other languages, it's represented in program source as '\b'
. It's sometimes displayed as ^H
.
All this applies whether it's represented as Unicode or not. The backspace character is common to most or all character sets: ASCII, Latin-1, the various Unicode representations -- even EBCDIC has a backspace character (but with a different code).
"this\b"
has a length of 5. Adding a backspace character to a string doesn't remove characters from the string. Its action of deleting characters occurs on the display, not in memory. –
Ayeaye \b
is written to a printer instead of a screen, it does overstriking instead of deletion. This allowed a primitive way to implement underlining (A\b_
), boldface (A\bA
), or accented characters (n\b~
). –
Kropotkin \b
on printers is universal. –
Ayeaye man
) usually produced _\bA
, not A\b_
. That way, on terminals without overstrike, the letter overwrites the underscore and not the other way around. –
Syriac © 2022 - 2024 — McMap. All rights reserved.