Breaking appart strings

cdoverlaw

Well-known member
Joined
Oct 11, 2003
Messages
146
how do i break the letters appart in a string as i am working on a soundex method to create a key for a surname
 
uhm splice was quite right, he only didnt see that Chars isnt a method but a property


you can go through each char by

string text = "blabla"; // :)

for (int i = 0; i < text.Length; i++)
{
char c = text.Chars;
...
}

or

foreach (char c in text.Chars)
{
...
}

of course dynamic_sysops answer is also write but unnecessarily complicated, but i would never criticize a forum leader *duck* :D

so many ways go to rome and you can use some different ways to get to your aim, just choose your style :) ( I prefer the for one at this situation :) )
 
Back
Top