Whitespace character
A whitespace character is a character data element that represents white space when text is rendered for display by a computer.
"Dot space" redirects here. For the animated film, see Dot in Space.
For example, a space character (U+0020 SPACE, ASCII 32) represents blank space such as a word divider in a Western script.
A printable character results in output when rendered,
but a whitespace character does not.
Instead, whitespace characters define the layout of text to a limited degree – interrupting the normal sequence of rendering characters next to each other.
The output of subsequent characters is typically shifted to the right (or to the left for right-to-left script) or to the start of the next line.
The effect of multiple sequential whitespace characters is cumulative such that the next printable character is rendered in a location based on the accumulated effect of preceding whitespace characters.
The term whitespace is rooting in the common practice of rendering text on white paper. Normally, a whitespace character is not rendered as white. It affects rendering, but it is not itself rendered.
Computing applications[edit]
Programming languages[edit]
In most programming language syntax, whitespace characters can be used to separate tokens. For a free-form language, whitespace characters are ignored by code processors (i.e. compiler). Even when language syntax requires white space, often multiple whitespace characters are treated the same as a single. In an off-side rule language, indentation white space is syntactically significant. In the satirical and contrarian language called Whitespace, whitespace characters are the only significant characters and normal text is ignored.
Good use of white space in source code can group related logic and make the code easier to understand.
Excessive use of whitespace, including at the end of a line where it provides no rendering behavior, is considered a nuisance.
Most languages only recognize whitespace characters that have an ASCII code. They disallow most or all of the Unicode codes listed above. The C language defines whitespace characters to be "space, horizontal tab, new-line, vertical tab, and form-feed".[29] The HTTP network protocol requires different types of whitespace to be used in different parts of the protocol, such as: only the space character in the status line, CRLF at the end of a line, and "linear whitespace" in header values.[30]
Command-line parsing[edit]
Typical command-line parsers use the space character to delimit arguments. A value with an embedded space character is problematic since it causes the value to parse as multiple arguments. Typically, a parser allows for escaping the normal argument parsing by enclosing the text in quotes.
Consider that one wants to list the files in directory named "foo bar". This command instead lists the files matching either "foo" or "bar":