为什么输入空格就出错了啊?
private void textBox1_TextChanged(object sender, EventArgs e){
}
private void button1_Click(object sender, EventArgs e)
{
string inputstr = new string (textBox1.Text.ToCharArray());
string outputstr = null;
char ch1;
for (int i = 0; i <= inputstr.Length - 1; i++)
{
ch1 = inputstr[i];
if (ch1 == 'a' || ch1 == 'A' || ch1 == 'o' || ch1 == 'O' || ch1 == 'u' || ch1 == 'U' || ch1 == 'e' || ch1 == 'E')
{
outputstr += "egg";
outputstr += ch1.ToString();
}
else
{
outputstr = ch1.ToString();
}
textBox2.Text = outputstr;
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
}
}
}