I need a sailor's knot for this string concatenation

Published 22 November 06 08:50 AM | Coding4Fun 

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.

Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# tzagotta said on November 22, 2006 3:32 PM:

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[].

Leave a Comment

(required) 
(optional)
(required) 
Page view tracker