View previous topic :: View next topic |
Author |
Message |
csauls
Joined: 27 Mar 2004 Posts: 278
|
Posted: Wed Aug 30, 2006 1:49 pm Post subject: Mango += mango.text.Text.join |
|
|
I found myself wanting a join() function in Mango's simple Text utility. So, I propose this little working one for the time being:
Code: | final static T[] join (T[][] src, T[] glue)
{
T[] ret;
ret ~= src[0];
foreach (sub; src[1 .. src.length])
{
ret ~= glue ~ sub;
}
return ret;
}
|
Feel free, of course, to add any sanity checks or the like as you deem neccessary. And look, I even tried my best to mimic Kris' coding style! (Much to the confusion and chagrin of my poor editor, but it'll just have to get over it.) _________________ Chris Nicholson-Sauls |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Sun Feb 04, 2007 11:25 am Post subject: |
|
|
who would believe this would take so long? The join() function is now templated within tango.text.Util |
|
Back to top |
|
|
csauls
Joined: 27 Mar 2004 Posts: 278
|
Posted: Mon Feb 05, 2007 2:58 pm Post subject: |
|
|
Good golly... I hardly even remember posting that! But thanks. _________________ Chris Nicholson-Sauls |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Mon Feb 05, 2007 3:57 pm Post subject: |
|
|
yeah, you posted not long after I left for that long trip |
|
Back to top |
|
|
|