Developer Documentation Library > UNICOM Intelligence Function Library > Text, categorical, and array functions > Len
 
Len
Returns a Long containing the number of characters in a string, the number of categories in a category list, or the number of elements in an array.
Syntax
Len(<value>)
Parameters
<value>
Type: Type: None
Text value, categorical value, or array to operate on.
(return)
Type: Type: Long
Numbers of characters, categories, or elements in <value>.
Notes
For type Text, the return value is the number of characters in <value>. For type Categorical, the return value is the number of categories in <value>. For an array (which can contain values of any type), the return value is the number of elements in <value>. For any other type, an error occurs.
When <value> is NULL, the return value is zero.
Examples
Function call
Val
Result
Notes
Len(Val)
24 St John's Road, Barnes
25
The return value is the number of characters in the supplied string.
Len(Val)
{4,2,9}
3
The return value is the number of categories in the supplied category list.
Len(Val)
Split("The quick brown fox")
4
The return value is the number of elements in the supplied array of text strings. For more information, see Split.
The following example returns the number of characters stored in the address text variable:
address.Len()
The following example returns the number of categories selected by the respondent in response to the remember multiple response question:
remember.Len()
For a mrScriptBasic example that uses Len, see CreateObject. For ideas for using Len in SQL queries, see I want to use the Data Model to access data, but I am used to SPSS-style data. Can you give me an overview?.
See also
Find
Text, categorical, and array functions