A Legacy Notes Developer's journey into madness.

XPages SSJS Function: @IsBlank

Devin Olson  August 13 2012 07:17:07 PM
Testing for blank strings can be kind of a PIA, and there are myriad examples all over the web on how to accomplish this.

Here is my version for XPages SSJS.  Enjoy:

function @IsBlank(source:String):boolean {
/*
        @IsBlank
        Tests a string to determine if it is blank.
       
        @param source: string to test.
        @return: Flag indicating if the string is blank.
*/
        return ((!source) || (0 === @Length(@Trim(source))));
} // @IsBlank