int LetterCount = 0;
string strText = "Debugging";
string letter;
for (int i = 0; i <strText.Length; i++)
{
letter = strText.Substring(0, 9);
if(letter == "g")
{
LetterCount++;
textBox1.Text = "g appears " + LetterCount + " times";
}
}
So, I am doing this training thing, and I am doing this exercise like 4 hours. And I can’t understand what’s wrong with my For Loop.
The point of the exercise is to get my program to tell me how much g is in the debugging word. But you probably understood that. Anyway, I'm not even sure that I have the correct code to tell me this, because I think I need to change the second part of the For Loop (i <) part.
, "if letter ==" g "" . , , , = , , g 24 , ( str.length 9 ?) 0 , .