On Friday, 16 August 2024 at 06:15:18 UTC, Bruce wrote:
Is there an easy way to create a 60 character string in D?
Like in Python...
ul = '-'*60

You can use the repeat() function in std.range to create a range of N consecutive elements. If you need to assign this range to a string, you'll have to use the array() function.

import std.range;
import std.stdio;

void main()
{

    string s = '-'.repeat(60).array;
    writeln(s);
}


Reply via email to