$ISVECTOR (ObjectScript)
Synopsis
$ISVECTOR(expr)
Description
The $ISVECTOR function determines if the input argument is a vector. If the input argument is a vector, the function returns 1 (true). The vector can be of any valid vector type, any length, and elements need not be contiguous. Valid vector types are decimal, double, integer, string, and timestamp. Additionally, $ISVECTOR("") returns 1.
If the input argument is not a vector, the function returns 0 (false). The function also returns false if the input expression is undefined or evaluates to the empty string.
Arguments
expr
Any ObjectScript expression.
Examples
The following example defines a length-10 vector of random integers between 1 and 100, defining every other element, checks if the defined vector is a vector, and writes the result. It also checks if a string is a vector and writes that result.
for i=2:2:10 set $VECTOR(vector,i,"integer") = $random(100)+1
set isvec = $ISVECTOR(vector)
write isvec // writes 1
set notvec = "This is not a vector."
set notvec = $ISVECTOR(notvec)
write notvec // writes 0