Splitting every character of a string?

you can use a simple for-loop with chars:

foreach (char ch in stringVar)
{
  Console.WriteLine(ch.ToString());
}

I fact you don't need to split it, because you already can acces every single char element in a string of its own.


You can iterate over the string like this:

foreach (char c in myString)
{
       Console.WriteLine(c);
}

String.ToCharArray()

From MSDN:

This method copies each character (that is, each Char object) in a string to a character array. The first character copied is at index zero of the returned character array; the last character copied is at index Array.Length – 1.

Tags:

C#

String

Split