Home

IsBlank

IsBlank is a predicate used in programming to indicate that a value has no visible content. In string processing, it typically returns true for values that are null, empty, or consist only of whitespace characters.

Common implementations vary by language. In Java, libraries such as Apache Commons StringUtils define isBlank(CharSequence) to

Edge cases include Unicode whitespace, non-breaking spaces, and locale-specific characters. Some libraries distinguish isBlank from isEmpty:

Common uses include input validation, data Cleaning, and preprocessing before storage or comparison. See also related

return
true
if
the
input
is
null,
empty,
or
whitespace
only.
In
JavaScript,
isBlank
is
often
implemented
as
value
==
null
||
/^\s*$/.test(value),
or
by
using
a
trim-based
check
such
as
value
==
null
||
value.trim().length
===
0.
In
Kotlin,
there
is
a
standard
extension
isNullOrBlank()
for
nullable
CharSequence,
which
returns
true
if
the
string
is
null
or
consists
solely
of
whitespace.
In
C#,
String.IsNullOrWhiteSpace
serves
a
similar
purpose,
treating
null
and
any
amount
of
whitespace
as
blank.
Python
lacks
a
standard
isBlank
function;
common
checks
use
strip()
or
isspace
on
strings.
isEmpty
usually
means
the
length
is
zero
and
does
not
consider
whitespace;
isBlank
commonly
includes
whitespace
and,
in
some
contexts,
null.
predicates
such
as
isEmpty
and
language-specific
equivalents
like
isNullOrWhiteSpace
or
isBlank
in
various
standard
libraries.