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
2010-06-13 20:50:38
ToCharArray() actually...
John Buchanan
2010-06-13 20:54:21
Whoops! Thanks, fixed...
Bryan Ross
2010-06-13 21:04:27
+1
A:
You can iterate over the string like this:
foreach (char c in myString)
{
Console.WriteLine(c);
}
Dan
2010-06-13 20:52:11