the best language I have ever met(?)

Stefan Koch via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Nov 18 16:28:36 PST 2016


On Friday, 18 November 2016 at 21:28:44 UTC, ketmar wrote:
> On Friday, 18 November 2016 at 20:31:57 UTC, Igor Shirkalin 
> wrote:
>> After 2 hours of brain breaking (as D newbie) I have come to:
>>
>> <code D>
>> uint_array.map!(v=>"%x".format(v)).join(", ")
>> </code D>
>> Why 2 hours? Because I have started with 'joiner' function and 
>> aftewords found out the 'join'.
>>
>> To my mind there is more simple form for this task in D (about 
>> formatting).
>
> sure ;-)
>
> import std.stdio;
> import std.format;
> void main () {
>   uint[$] a = [42, 69];
>   string s = "%(%s, %)".format(a);
>   writefln(s);
> }

Please don't post non-d.
People might use it an then complain that it does not work.



More information about the Digitalmars-d-learn mailing list