string repeat
Gives a string repeated a number of times.
string repeat STRING COUNT
Description
Gives STRING COUNT times, with no separator. A COUNT of 0 or below gives an empty string, and so does an empty STRING. The result counts toward the memory limit of the interpreter.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| STRING | string | required | The text to repeat. |
| COUNT | integer | required | The count of copies. |
Returns
The new string.
Examples
% string repeat ab 3
ababab
% string repeat ab 0
% string repeat ab -1
Errors
% string repeat ab x
expected integer but got "x"
-errorcode NONE
% string repeat a
wrong # args: should be "string repeat string count"
-errorcode TCL WRONGARGS
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.1