On Wednesday, 11 November 2015 at 13:32:00 UTC, perlancar wrote:
    for (int rownum=0; rownum < table.length; rownum++) {
        res ~= "|";
for (int colnum=0; colnum < table[rownum].length; colnum++) { res ~= leftJustify(table[rownum][colnum], widths[colnum]);
            res ~= "|";
        }
        res ~= "\n";

Not sure if this will be faster, but you could try rewriting the above for loop
with more functional code (code below is untested):

table.map!((col)
  { return zip(col,widths)
              .map!( (e) => leftJustify(e[0], e[1] ) )
              .join("|");
  }).join("\n");

Cheers,

Edwin

Reply via email to