Determines whether or not a string is empty or contains only whitespace characters.
JSV_isWhitespace(expS)
expS.isWhitespace()
The isWhitespace function returns true if the expression expS is empty or contains only whitespace characters; otherwise, false.
The isWhitespace function uses the following argument.
Argument | Description |
expS | The string that is to be evaluated. |
The whitespace characters are:
Whitespace Character |
Character Information | |
---|---|---|
space | ||
\t | tab | |
\n | line feed | |
\r | carriage return |
A string is considered empty if its length is 0 or it is null.
The following lines of code
var testString1 = " ", testString2 = "Bob\n";
document.write( "testString1 is white space? " +
JSV_isWhitespace(testString1) );
document.write( "testString2 is white space? " +
JSV_isWhitespace(testString2) );
var testNumber = 123;
document.write( "testNumber is white space? " +
JSV_isWhitespace(testNumber) );
produce
Copyright © 1998-2000 Roaring Fork Software. All rights reserved.