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);
}

Accepted.
Is it really needed to call 'writefln'? I mean 'f'.

Reply via email to