Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #257 (closed enhancement: fixed)

Opened 17 years ago

Last modified 17 years ago

need a join() function, that will turn [][] into []

Reported by: qbert Assigned to: kris
Priority: major Milestone: 0.96 Beta 2
Component: Tango Version:
Keywords: Cc:

Description

Something like

T[] join(T)(T[][] items,T[] glue = "" ) {

T[] result; foreach ( item;items )

{

result ~= item ~ glue;

}

return result;

}

Change History

02/03/07 19:31:40 changed by kris

  • status changed from new to assigned.

You can do this kind of thing rather efficiently if you have a Buffer lying around:

foreach (segment; items)
         buffer.append(segment).append(glue);

But there's not always a buffer handy :)

I'll see about adding your function to tango.text.Util, with an optional output buffer as the last argument :)

02/03/07 22:03:57 changed by kris

  • status changed from assigned to closed.
  • resolution set to fixed.

see tango.text.Util