tags:

views:

129

answers:

3

HI, I want to split a string into each single character. Eg: Splitting : "Geeta" to "G", "e", "e" , "t", "a" How can I do this? I want to split a string which don't have any separator Please help.

+7  A: 

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.

Sebastian P.R. Gingter
+10  A: 

String.ToCharArray()?

Bryan Ross
ToCharArray() actually...
John Buchanan
Whoops! Thanks, fixed...
Bryan Ross
+1  A: 

You can iterate over the string like this:

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