Script Function: Converts a script array to a string.
ARRAY_2_STRING(Script Array, [Separator], [Area])
Syntax |
Description/Format |
---|---|
Script Array |
The variable name of the array. |
Separator | One or several characters that should be included in the string between the array elements. Format: script variable or script literal |
Area |
The area of the array. Allowed values: "ALL" or "FILLED" (default) "ALL" = All the array's elements are used. |
Return Codes |
---|
The string that includes the element of the array. |
This script function supplies the elements of a script array as a string. The variable name of the array must be specified with the empty index brackets [].
You can also determine one or several separators that separate the elements from each other in the resulting string.
You can also determine whether all elements or only all filled elements should be used. If only the filled elements should be used, the empty elements at the end of the array are ignored.
The following example script creates an array and fills it with the entries of a Variable object. Subsequently, the array is converted to a string and output in the activation report. A hyphen is used as a separator for the array elements.
:DEFINE &ARRAY#, string, 5
:DEFINE &STR#, string
:FILL &ARRAY#[] = GET_VAR(VARA.STATIC.TEST,"KEY01")
:SET &STR# = ARRAY_2_STRING(&ARRAY#[],"-",FILLED)
:P "&STR#"
See also:
Script Elements | Description |
---|---|
:CLEAR | Resets a script array to its initial values |
Declares a script variable with a particular data type. |
Script Elements - Script Structure and Processing
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function