winform程序之两种从email中提取用户名和域名(简单)

按以上布局,

分析1事件:

<textarea cols="50" rows="15" name="code" class="c-sharp"> int atindex = textBox1.Text.IndexOf("@"); if (atindex == -1) { MessageBox.Show("非法"); return; } textBox2.Text = textBox1.Text.Substring(0, atindex); textBox3.Text = textBox1.Text.Substring(atindex + 1);</textarea>

分析2:

<textarea cols="50" rows="15" name="code" class="c-sharp"> string[] emailstring = textBox1.Text.Split('@'); if (emailstring.Length &lt; 2) { MessageBox.Show("非法"); return; } textBox2.Text = emailstring[0]; textBox3.Text = emailstring[1]; </textarea>

你可能感兴趣的:(winform程序之两种从email中提取用户名和域名(简单))