I need a sailor's knot for this string concatenation

Sign in to queue


Phil Haack wrote an entry regarding concatenating delimited strings together.  He goes on an shows different approaches on how to create a delimiting function along with some of his commets too.

Phil goes on to mention .Net 2.0 has a string.Join method while .Net 1.1 does not. 

If you're using JavaScript, there is a join on array objects too.



The Discussion

  • User profile image

    I appreciate the author raising some awareness about string.join (I didn't know it was there), but I think his application of it is a little ill-conceived.

    In my opinion, string.join would be most appropriate if you alrady have a string[] for other reasons.  If you just want to concatenate strings, using StringBuilder and iterating across all the items will be more efficient most of the time, because it takes time and memory to allocate the temporary string[].

Add Your 2 Cents