strrep()
Replicates a string the number of times specified.
Syntax
strrep(
value,
multiplier,
[ delimiter ])
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
value | string |
✔️ | The string to replicate. |
multiplier | int |
✔️ | The amount of times to replicate the string. Must be a value from 1 to 67108864. |
delimiter | string |
The delimeter used to separate the string replications. The default delimiter is an empty string. |
Note
If value or delimiter isn't a string
, they'll be forcibly converted to string.
Returns
The value string repeated the number of times as specified by multiplier, concatenated with delimiter.
If multiplier is more than the maximal allowed value of 1024, the input string will be repeated 1024 times.
Example
print from_str = strrep('ABC', 2), from_int = strrep(123,3,'.'), from_time = strrep(3s,2,' ')
Output
from_str | from_int | from_time |
---|---|---|
ABCABC | 123.123.123 | 00:00:03 00:00:03 |
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for