Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Previous sectionNext section


Repeats the string value of each element of a dynamic array.




dynarray An expression that resolves to a dynamic array.
repeats An expression that resolves to a positive integer specifying the number of repetitions of the current value of each element.


The STRS function replicates each element of a dynamic array the number of times specified by repeats. In the returned dynamic array the value of each element of dynarray is replicated and concatenated the same number of times. The number of replications is specified by the repeats argument.

The repeats argument specifies the number of repeats as a positive integer. If repeats is a decimal number, it is truncated to an integer. The repeats string is parsed as an integer until a non-numeric character is encountered. Thus “7dwarves” is parsed as 7. If repeats is 0, a negative number, or a non-numeric string, STRS returns a null string for all elements.

You can use the STR function to perform the same operation on a single value.


The following example uses the STRS function to triplicate the value of each element of a dynamic array. Note that the third element is a null string:

PRINT STRS("test",3)
Copy code to clipboard

It returns: AAAýBBBýýDDDýEEE

See Also

FeedbackOpens in a new window