c# for each char in string code example
Example: c# iterate over string
// Regular Strings
string foo = "hello world", bar = string.Empty;
foreach(char c in foo){
bar += c;
}
// StringBuilder
string foo = "hello world";
StringBuilder bar = new StringBuilder();
foreach (char c in foo)
{
bar.Append(c);
}