Skip to content

StringUtils.isBlank

Signature: StringUtils.isBlank(inputString)

Returns: Boolean isBlank - true if the inputString is null, empty, whitespace or exactly "undefined"

Checks if the inputString is null, empty (""), whitespace, or exactly the string "undefined".

Note

A JavaScript value that is undefined (an undeclared variable, a missing object property, or an argument that was not passed) reaches this function as the literal string "undefined", so it is reported as blank. The comparison ignores case, and the value must be exactly "undefined" with no surrounding whitespace.

Parameters

Type Name Description Default
String inputString the String to check, may be null

Example

StringUtils.isBlank('         Not blank');          // false
StringUtils.isBlank('                          ');  // true
StringUtils.isBlank('undefined');                   // true
StringUtils.isBlank(' undefined ');                 // false