STRREPEAT

Purpose:

Repeats a string 1 or more times.

Syntax:

STRREPEAT("str", n, "sep")

"str"

-

A string. The source string.

n

-

An integer. The number of times to repeat the string

"sep"

-

Optional. A string, the separator string. Defaults to "", the empty string.

Returns:

A string, the result of replicating str n times.

Example:

strrepeat("ABC", 3)

 

returns "ABCABCABC".

 

Example:

strrepeat("ABC", 3, "+")

 

returns "ABC+ABC+ABC".

Example:

s = "aaa AAA ";

s1 = strrepeat(s, 2);

s2 = s * 2;

 

Both s1 and s2 contain the string "aaa AAA aaa AAA ".

Example:

s1 = "123 ";

s2 = "123 ";

s1 = strrepeat(s1, 5);

s2 *= 5;

 

Both s1 and s2 contain the string "123 123 123 123 123 ".

Remarks:

STRREPEAT repeats the source string n times.

 

The * operator also replicates strings. For example:

 

"String 1" * 3

 

is equivalent to:

 

strrepeat("String1", 3)

 

and yields:

 

"String1String1String1"

 

The *= operator repeats a string to an existing string:

 

s1 = "String 1";

s1 *= 3;

 

s1 == "String1String1String1"

See Also:

STRCAT

STRCMP

STREXTRACT

STRFIND

STRGET

STRMATCH

STRREPLACE

STRSORT

STRTRIM