ISNOTEMPTY

The function ISNOTEMPTY returns a TRUE if the given object, string, or list is not empty.

This function takes an object, string, or list as input. It outputs a boolean indicating whether the given object, string, or list is not empty: TRUE means that it is not empty, FALSE means that it is. It can also accept NULL as input, in which case it will return FALSE.

Declaration

ISNOTEMPTY(var) -> bool

 

Parameters

var (type: object | string | array | null)
Any object, string, or list. It will also accept a lack of value, or NULL, as valid input.

Return Values

bool (type: boolean)
A boolean indicating if var is empty. It will output TRUE if it is not empty and FALSE otherwise.

Examples

In practice, input fed into the ISNOTEMPTY function is very rarely hardcoded; there is no real need to use software to check if an object, string, or array is not empty after just typing it. However, for the sake of clarity, the following examples will use hardcoded input in order to demonstrate what ISNOTEMPTY will output given certain types of input.

The first example checks to see if an empty list is not empty; that is, if the empty list contains any items. It does not:

ISNOTEMPTY([]) -> FALSE

The following example checks to see if a blank string is not empty; that is, if the blank string contains any characters. It does not:

ISNOTEMPTY("") -> FALSE

The following example checks to see if a list containing a single blank string is not empty. This list does not count as empty – it contains an item, even that item is only a single blank string:

ISNOTEMPTY([""]) -> TRUE

The following example checks to see if an object containing no name-value pairs is not empty. The complete lack of name-value pairs makes this object empty by definition:

ISNOTEMPTY({}) -> FALSE

The following example checks to see if an object containing a single name-value pair – in which the name and the value are both blank strings – is not empty. While the name and value are both blank strings, their existence means that the object contains name-value pair, and thus the object doesn't count as empty:

ISNOTEMPTY({"name": ""}) -> TRUE

The last example checks if NULL – the lack of any value – is empty. For the purposes of the ISNOTEMPTY function, lack of any value counts as empty:

ISNOTEMPTY(NULL) -> FALSE

 

Discussion

The ISEMPTY function can be considered the opposite of the ISEMPTY function: : they check for the same thing, but ISNOTEMPTY returns FALSE when ISEMPTY would return TRUE and visa versa.