Category Archives: Lambda

Insert delimiters between each character of a string

For example, to make the string “abcde” becomes “a,b,c,d,e” or “a b c d e”. What I’m going to do is to convert the string to a char array and then use String.Join to join the chars with the specific delimiters. There are different ways to accomplish it base on different versions of .NET Framework.

.NET 2.0
First using String.ToCharArray to convert the original string into a char array. Since String.Join takes a string array as the 2nd parameter, the char array needs to be converted into a string array. In .NET 2.0 we could use Array.ConverAll:

Read the rest of this entry »

Leave a comment

Posted by on May 9, 2012 in .NET, Lambda, LINQ, VB