空格、空格和製表符是字元串的一部分嗎?
空格和空格有區別嗎?
製表符、空格、空格是否被視為字元?
在這種情況下,沒有“空白”之類的東西。您所擁有的只是字元,而某些字元實際上並沒有在普通文本中列印出您可以看到的任何內容。然而,一切都是用字元來表達的,是的。ASCII 中有很多非列印字元,您可以在此處找到完整列表:https ://web.itu.edu.tr/sgunduz/courses/mikroisl/ascii.html 。您可能在文本文件中遇到的是各種空白字元,它們是:
空間:
* Tab:
\t`Newline:
\n
Carriage return:
\r``
And, less commonly:Bell:
\a
Backspace:
\b
Vertical tab:
\v
Form feed:
\f
You also have the NULL (
\0
) which is non-printing but doesn’t appear in text files, as well as the special escape (\e
or^[
) and Control-Z (^Z
) characters but, again, not really found in text files.Relevant links
So, a “blank” can be a space or a tab or another whitespace character. Or, if you are working with Unicode and not ASCII, you have various other weird things as well. But no matter what you have, they will be characters. When you see whitespace in text, the computer sees some character. A “blank” is never the absence of a character, it is always the presence of a non-printing character.`