标签:span nbsp vat end ++ ++i 提示 输入 oid
实现效果:
关键知识:(StringBuilder的使用&.Length属性)
完成代码:
1 private void button1_Click(object sender, EventArgs e) 2 { 3 if (textBox1.Text != string.Empty&&textBox3.Text!=string.Empty) 4 { if(button1.Text.Equals("清空")) 5 { //清空内容 6 textBox1.Text = ""; 7 textBox2.Text = ""; 8 textBox3.Text = ""; 9 button1.Text = "开始"; 10 } 11 StringBuilder P_stringbuilder =//创建字符串处理对象 12 new StringBuilder(textBox1.Text); 13 for (int i = 0; i <P_stringbuilder.Length; i++) 14 {//循环 15 if (P_stringbuilder [i] ==textBox3.Text[0]) 16 {//判断是否符合 17 P_stringbuilder. 18 Insert(++i, Environment.NewLine);//换行输出 19 textBox2.Text =P_stringbuilder.ToString (); 20 button1.Text = "清空"; 21 } 22 } 23 } 24 else { MessageBox.Show("你还没有输入┗|`O′|┛ 嗷~~","提示:"); } 25 }
标签:span nbsp vat end ++ ++i 提示 输入 oid
原文地址:https://www.cnblogs.com/feiyucha/p/9898282.html