Returns a substring for each element of a dynamic array.
||An expression that resolves to a dynamic array of elements from which a dynamic array of substrings is to be extracted.
||An expression that resolves to a positive integer specifying the start position (counting from 1) within each element to begin extracting a substring.
||An expression that resolves to a positive integer specifying the number of characters to extract from each element, beginning with the start position.
function returns a dynamic array of substrings, each substring element containing the specified length
number of characters from the corresponding dynarray
returns a substring for every element, regardless of the element's level delimiter.
is 1, substrings are extracted starting with the first character of each element. If start
is 0, a negative number, the null string, or a non-numeric string, SUBSTRINGS
behaves as if start
=1. If start
is greater than the character length of an element, the returned dynamic array contains only the level delimiter for that element.
is greater than the dynarray
element's length, the full element value is returned. If length
is 0, a negative number, the null string, or a non-numeric string, the length
is parsed as 0; the returned dynamic array contains only the level delimiters from the original dynarray
is a mixed numeric string, the numeric part is parsed until a non-numeric character is encountered. Thus 7dwarves is parsed as 7.
You can use the  string operator to perform a similar substring extract from a string. For further details, refer to the Operators
page of this manual.
The following example uses the SUBSTRINGS
function to return a dynamic array containing the first three characters of each element of a dynamic array:
! Returns: "NewýLonýChiýBosýLos"
© 1997-2019 InterSystems Corporation, Cambridge, MA