REPEAT

Transformational Intrinsic Function (Generic): Concatenates several copies of a string.

Syntax

result = REPEAT (string, ncopies)

string
(Input) Must be scalar and of type character.

ncopies
(Input) Must be scalar and of type integer. It must not be negative.

Results:

The result is a scalar of type character and length ncopies x LEN(string). The kind parameter is the same as string. The value of the result is the concatenation of ncopies copies of string.

Compatibility

CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB

See Also: SPREAD

Example

REPEAT ('S', 3) has the value SSS.

REPEAT ('ABC', 0) has the value of a zero-length string.

The following shows another example:

 CHARACTER(6) str
 str = REPEAT('HO', 3)  ! returns HOHOHO