replicate, replicate characters
The function replicate() repeats the specified string by the number provided.
The function replicate characters() repeats the specified string until the specified number of characters has been reached.
Note: The count will be recognized as an integer and will be rounded down if needed.
Vectorization: This function supports vectorization in the 1st function parameter.
Instead of providing a single value, you can provide a set or even a nested set which contain multiple values.
The function will then process every value and its return value contains a corresponding set containing all results.
Indirect parameter passing is disabled
Vectorization is allowed in the 1st function parameter
1
No. | Type | Description |
---|---|---|
1 input |
string set |
String This is the source string which will be replicated. Alternatively, provide a (nested) set with multiple strings to make use of vectorization. |
2 input |
numeral | Replication or character count Specifies the number of repetitions or characters in the final string |
Type | Description |
---|---|
string set |
Processed string Specified replication or character count. A set will be returned with the results if vectorization is used. |
echo( replicate( Café, 10 ) );
echo( replicate characters( Café, 10 ) );
echo( replicate ( { Café, Caffè }, 5 ) ); // Vectorization
CaféCaféCaféCaféCaféCaféCaféCaféCaféCafé
CaféCaféCa
{'CaféCaféCaféCaféCafé','CaffèCaffèCaffèCaffèCaffè'}