REPEAT
Description
The REPEAT function is used to repeat a string str times times and return the generated string.
Parameters
str(string type): The string to be repeated.times(int type): The number of times the stringstrneeds to be repeated.
Return Type
Returns a string that is the result of repeating str times times.
Example Usage
- Repeating a single character:
Results:
- Repeat a word: {#repeat-a-word}
Results:
- Use with other functions, such as concatenating strings:
Results:
Notes
- Ensure the
timesparameter is a positive integer, otherwise the function will return an empty string. - When
timesis 0, the function returns an empty string. - If the
strortimesparameters are not of the expected type, the function may return an error or an empty string.
By using the REPEAT function, you can easily create strings with repeating patterns, which is very useful for generating test data or padding strings.
