REPEAT(STRING, NCOPIES)

Purpose

Concatenate several copies of a string.

Class

Transformational function

Argument type and attributes

STRING
An INTENT(IN) CHARACTER scalar.
NCOPIES
An INTENT(IN) INTEGER scalar. Its value must not be negative.

Result type and attributes

Character scalar with a length equal to NCOPIES * LENGTH(STRING), with the same kind type parameter as STRING.

Result value

The value of the result is the concatenation of NCOPIES copies of STRING.

Examples

REPEAT ('H', 2) has the value 'HH'. REPEAT ('XYZ', 0) has the value of a zero-length string.