I faced a problem where invisible character \\0
which is pretty like a \'white space\' not considered as white space by the string.IsNullOrWhiteSpace method. I
For fun historical reasons (they are surely fun, but I wasn't able to find them), null
has two meanings... The null
pointer/reference (called NULL
in C), and the NUL
(or NULL
) \0
character.
String.IsNullOrWhiteSpace does:
Indicates whether a specified string is null, empty, or consists only of white-space characters.
with null
meaning the "null
reference", empty meaning empty and white-space meaning
White-space characters are defined by the Unicode standard. The
IsNullOrWhiteSpace
method interprets any character that returns a value of true when it is passed to theChar.IsWhiteSpace
method as a white-space character.
The list of characters that Char.IsWhiteSpace considers a space is present in the page of Char.IsWhiteSpace
.