repeat method
- int count = 1
Repeats the String
count
times.
Example
String foo = 'foo';
String fooRepeated = foo.repeat(5); // 'foofoofoofoofoo'
Implementation
String repeat([int count = 1]) {
if (isBlank || count <= 0) {
return blankIfNull;
}
var repeated = this;
for (var i = 0; i < count - 1; i++) {
repeated += this;
}
return repeated;
}