views:

928

answers:

2

Hi, I want to split a string in C#.NET that looks like this:

string Letters = "hello";

and put each letter (h, e, l, l, o) into an array or ArrayList. I have no idea what to use as the delimiter in String.Split(delimiter). I can do it if the original string has commas (or anything else):

string Letters = "H,e,l,l,o";
string[] AllLettersArray = Letters.Split(",".ToCharArray());

But I have no idea what to use in a case with (supposedly) no delimiter. Is there a special character like Environment.Newline? Thanks.

+8  A: 

Remember, you can access a string as an array in c#.

string str = "hello";
char[] letters = str.ToCharArray();

Justin Cherniak
Thanks, I combined yours and the other guy's answers, and everything worked great.
Zach
No problem, enjoy.
Justin Cherniak
A: 

This would return an array of charcaters, not string.

Smith