I need a way to insert a comma after every character in a string. So for example, if i have the string of letters
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
I need to make it so there is a comma after every letter from A, to Z,
I would like to keep the string as it is and not convert it to a char array or something like that. I dont know if thats possible but its just something id like to avoid.
How can i do this?
End result should be this:
"A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,"
Thanks
In .Net 4:
.Net 4.0 adds a
String.Joinoverload that takes anIEnumerable<T>.This code calls it with
Stringcasted toIEnumerable<char>.I need to explicitly specify the generic type parameter or it will call the
params string[]overload (using a singlestring) instead.