4.08 Data Variable Functions

SWAP

Function:

Exchanges the values of two variables. The parameters may be variables of any type.

Syntax:

SWAP a, b 

Example:

LEN

Function:

Returns the length of a string, the number of elements in an array or for a number returns the length that woudl be returned from the STR() function.

Syntax:

LEN(value)
value
Any variable or expression

Example:

put len("1.2345")  // 6

ISEMPTY

Function:

Returns true if the len of a value is 0, or if an integer or a real is 0 or if an array has no elements.

Syntax:

ISEMPTY(value)
value
Any variable or expression

Examples:

put isempty('')          // 1
put isempty(' ')         // 0
put isempty(trim(' '))   // 1
put isempty(0)           // 1
put isempty(0.1)         // 0
put isempty(1000)        // 0

ISARRAY

Function:

Returns true if a value is an array.

Syntax:

ISARRAY(value)
value
Any variable or expression

Examples:

put isarray({1,2,3})   // 1
put isarray('{1,2,3}') // 0

ISNUMBER

Function:

Returns true if a value is a number or it can be converted to a number.

Syntax:

ISNUMBER(value)
value
Any variable or expression

Examples:

put isnumber(12)          // true
put isnumber("12")        // true
put isnumber("12E+2")     // true
put isnumber("abc")       // false
put isnumber("1+2")       // false
put isnumber("int(2.4)")  // false

ISSTRING

Function:

Returns true if a value is a string and cannot be converted to a number.

Syntax:

ISSTRING(value)
value
Any variable or expression

Examples:

put isstring(12)      // false
put isstring("12")    // false
put isstring("12E+2") // false
put isstring("abc")   // true
put isstring("1+2")   // true

lynplex/lp0408.txt · Last modified: 2011/09/08 16:07 (external edit)