Xbasic

ISNULL Function

Syntax

Result_Flag as L = isNull(C String )

Arguments

String

A character string.

Returns

Result_FlagLogical

Returns .T. (TRUE) if a character string is blank ("") or contains only whitespace characters; otherwise, it returns .F. (FALSE).

Description

Tests if a string is empty or contains only whitespace.

Discussion

ISNULL() can be used to test if a string is empty or contains only whitespace. The function returns true if the string is blank ("") or contains only whitespace characters, such as tabs and spaces.

Example

dim company as c = "Alpha Software"
? isNull(company)
= .F.

company = ""
? isNull(company)
= .T.

' String is a space character
? isNull(" ")
= .T.

' String is a tab character
? isNull("	")
= .T.

' String contains only newlines
dim str as c = crlf(2)
? isNull(str)
= .T.

' String contains a combination of whitespace, including newlines, tabs, and spaces
str = crlf(2) + " " + crlf(2) + chr(9) + " " + crlf(2)
? isNull(str)
= .T.

? len(str)
= 15

See Also