Multiply a string?

Neto netorib94 at gmail.com
Sat Jun 21 16:40:59 UTC 2025


On Saturday, 21 June 2025 at 12:43:31 UTC, Jabba Laci wrote:
> On Saturday, 7 June 2025 at 16:13:06 UTC, Andy Valencia wrote:
>> Which is to say, build a string by concatenating " " ddepth 
>> times.  Is there a comparable idiom in dlang or Phobos?
>
> I use this:
>
> ```d
> import std.stdio;
> import std.array;  // from here
>
> void main()
> {
>     writeln("-".replicate(5));  // must be a string
> }
> ```

very nice solution


More information about the Digitalmars-d-learn mailing list