SUBSTRINGS


The SUBSTRINGS function returns a dynamic array of elements which are sub-strings of the corresponding elements in a supplied dynamic array.

 

COMMAND SYNTAX

SUBSTRINGS(DynArr, Start, Length)

 

SYNTAX ELEMENTS

DynArr should evaluate to a dynamic array.
Start specifies the position from which characters are extracted from each array element. It should evaluate to an integer greater than zero.
Length specifies the number of characters to extract from each dynamic array element. If the length specified exceeds the number of characters remaining in an array element then all characters from the Start position are extracted. 

 

EXAMPLES

The following program shows how each element of a dynamic array can be changed with the SUBSTRINGS function.

t = ""
t<1> = "AAAAA"
t<2> = "BBBBB" : @VM: "CCCCC" : @SVM: "DDDDD"
t<3> = "EEEEE":@VM:@SVM

r1 = SUBSTRINGS(t,3,2)
r2 = SUBSTRINGS(t,4,20)
r3 = SUBSTRINGS(t,0,1)

 

The above program creates 3 dynamic arrays. v represents a value mark. s represents a sub-value mark.

r1 <1>AA
<2>BB v CC s DD
<3>EE v s
r2 <1>AA
<2>BB v CC s DD
<3>EE v s
r3 <1>A
<2>B v C s D
<3>E v s

jBC