Is there a more elegant way to do this in D?

Ali Çehreli acehreli at yahoo.com
Thu Apr 8 04:02:26 UTC 2021


On 4/7/21 8:57 PM, Brad wrote:

>      auto a = [1,0,1,1,1,0,1,0,1,1,1,1,0];

> I want to come out of this with a string that looks like this: 
> 1011101011110

Me, me, me, me! :)

import std;
void main()
{
   auto a = [1,0,1,1,1,0,1,0,1,1,1,1,0];

   string s = format!"%-(%s%)"(a);
   writeln(s);
}

Ali



More information about the Digitalmars-d-learn mailing list