an input range or a dynamic array
number of times to repeat s
An array that consists of s repeated n times. This function allocates, fills, and returns a new array.
auto a = "abc"; auto s = replicate(a, 3); assert(s == "abcabcabc"); auto b = [1, 2, 3]; auto c = replicate(b, 3); assert(c == [1, 2, 3, 1, 2, 3, 1, 2, 3]); auto d = replicate(b, 0); assert(d == []);
For a lazy version, refer to std.range.repeat.