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

Jack jckj33 at gmail.com
Thu Apr 8 16:47:50 UTC 2021


On Thursday, 8 April 2021 at 16:45:14 UTC, Jack wrote:
> On Thursday, 8 April 2021 at 04:02:26 UTC, Ali Çehreli wrote:
>> 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
>
> What does %-%s% do?

nevermind, someone just asked this too[1]

[1]: 
https://forum.dlang.org/thread/immypqwvbealjqrvbqln@forum.dlang.org




More information about the Digitalmars-d-learn mailing list