Scripting > UNICOM Intelligence Function Library > Text, categorical, and array functions > Right
 
Right
Returns a string containing the last characters from a string, a category list containing the last categories from a category list, or an array containing the last elements from an array.
Syntax
Right(Val, Length)
Parameters
Val
Type: Type: None
Text value, categorical value, or array to operate on.
Length
Type: Type: Long
Number of characters, categories, or elements to return. If Length is greater than the number of items available, all of the items are returned.
(return)
Type: Type: None
The required characters, categories, or elements from Val.
Remarks
For type Text, the return value is of type Text, and contains Length characters from the end of Val. For type Categorical, the return value is of type Categorical, and contains Length categories from the end of Val. For an array (which can contain values of any type), the return value is an array, and contains Length elements from the end of Val. For any other type, an error occurs.
When Val is NULL, the return value is NULL.
Examples
Function call
Val
Length
Result
Notes
Right(Val, Length)
24 St John's Road, Barnes
6
Barnes
The return value is the last six characters in the supplied string.
Right(Val, Length)
{4,2,9,15,6,7}
1
{7}
The return value is the last category in the supplied category list.
Right(Val, Length)
Split("The quick brown fox")
3
{quick,brown,fox}
The return value is the last three elements in the supplied array. See Split for more information.
The following example returns the 10 rightmost characters stored in the address text variable:
address.Right(10)
The following example returns the last two categories in the list of categories stored in the remember multiple response variable:
remember.Right(2)
See also
Find
Text, categorical, and array functions