Function: Enter email address, output username and domain name
String[] String.Split (params char[] separator) (+5 overloads))
The returned string array contains the string for this instance (delimited by the elements of the specified Unicode character array)
The source code is as follows:
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceEmail Analysis { Public Partial classForm1:form { PublicForm1 () {InitializeComponent (); } Private voidButton1_Click (Objectsender, EventArgs e)//Enter email address, output username and domain name { stringemail = TextBox1.Text;//E- Mail string Save first text box /*string[] String.Split (params char[] separator) (+5 overloads) * Returns a string array containing the strings of this instance (delimited by the elements of the specified Unicode character array) */ string[] STRs = email. Split ('@'); if(STRs. length!=2) {MessageBox.Show ("an illegal email address! "); return;//don't forget to return.} TextBox2.Text=strs[0];//the first part of the split string is assigned to the text box 2textbox3.text=strs[1];//post-section string assignment to text box 3 } }}
Run:
Software: http://pan.baidu.com/s/1bnpg8d5 Password: gvq6