Split String in C # without a separator (sort of)

I want to break a line in C # .NET that looks like this:

string Letters = "hello"; 

and put each letter ( h, e, l, l, o ) in an array or ArrayList. I have no idea what to use as a separator in String.Split(delimiter) . I can do this if the source string has a comma (or something else):

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

But I have no idea what to use in the case of (presumably) without a separator. Is there a special character like Environment.Newline ? Thanks.

+6
string arrays split c #
source share
1 answer

Remember that you can access a string as an array in C #.

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

+23
source share

All Articles