Is string empty?

Syntax

int empty(s)

 

Parameters

s - string. Can be of type lpstr, str, BSTR, word*, VARIANT.

 

Remarks

Returns 1 if s is empty, or 0 if not.

 

Added in QM 2.3.0.

 

Type s is empty if
lpstr null or "".
str The len property is 0.
BSTR The len property is 0.
word* null or L"".
VARIANT vt is VT_BSTR and the len property of bstrVal is 0. Or vt is VT_EMPTY or VT_NULL. Note that this function always returns 1 for other types, even if the value is 0.

 

Tips

Don't use if(s="") to check if s is empty. It will not work if s is null. Also it will not work if s is not str. Instead use if(empty(s)).

 

See also: len

 

Example

 /
function lpstr's

if(empty(s)) ret ;;exit the function if s is empty ("" or 0)
 ...