FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Mango += mango.text.Text.join

 
Post new topic   Reply to topic     Forum Index -> Mango
View previous topic :: View next topic  
Author Message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Wed Aug 30, 2006 1:49 pm    Post subject: Mango += mango.text.Text.join Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Sun Feb 04, 2007 11:25 am    Post subject: Reply with quote

who would believe this would take so long? The join() function is now templated within tango.text.Util
Back to top
View user's profile Send private message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Mon Feb 05, 2007 2:58 pm    Post subject: Reply with quote

Good golly... I hardly even remember posting that! Smile But thanks.
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Mon Feb 05, 2007 3:57 pm    Post subject: Reply with quote

yeah, you posted not long after I left for that long trip Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Mango All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group