In article <(E-Mail Removed)>,
(E-Mail Removed)
says...
>
> Very often while programming, I need to create a delimited string with various values.
>
> value1;value2;value3
>
> Here is the problem I run into, and this isn't that big of deal, I always work around it.
> I either have to check to see if it is the first value I added, and not put the delimiter, which each subsequent value would be delimiter & value,
> or
> after I add all the values, I remove the delimiter from the end.
>
> Either works fine, I was just wondering if there is a more efficient, easier to code, way I could be going about this.
>
> I was looking at the string builder class, and I didn't see this ability, but if I could load all the values, then perform a tostring that would delimit them for me, that would work so much easier! Maybe there are some other objects out there that could do this, or even I could extend the StringBuilderClass
>
> Anyone have any ideas?
Look into the "Join" function.
--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele