
Caché MultiValue Basic Reference
LENS



Server:docs1 
Instance:LATEST 
User:UnknownUser 


Returns the length of each element of a dynamic array.
Synopsis
The
LENS function returns the number of characters in each element of a dynamic array.
LENS counts characters, not bytes. Results are returned as a dynamic array of integers.
For numerics, prior to determining the length MVBasic performs all arithmetic operations and converts numbers to canonical form, with leading and trailing zeroes, a trailing decimal point, and all signs removed except a single minus sign. Note that
LENS does count the decimal point and the minus sign. Numeric strings are not converted to canonical form. An empty string ("") or a missing element returns a length of 0 for that element.
The following example uses the
LENS function to return the number of characters in each element of a dynamic array. Numbers are converted to canonical form:
nums=123:@VM:12.300:@VM:++0123.00:@VM:"+123.00":@VM:""
PRINT LENS(nums); ! Returns 3ý4ý3ý7ý0
The following example show how
LENS handles missing dynamic array elements:
nums=123:@VM:456:@VM:@VM:789
PRINT LENS(nums); ! Returns 3ý3ý0ý3