Create an application that accepts into a textbox a person’s first given and family names (with one or more spaces between them) and when a “Separate Names” button is clicked the names are displayed separately with appropriate labelling. For example, entry of “Bob Brown” will result in an output of Family Name : Brown Given Name : Bob
here's my code:
string str=textBox1.Text;
string[] name = str.Split(' ');
MessageBox.Show("Family Name: " + name[1] + "\t" + "Given Name: " + name[0]);
how do I do this if there are more than one space in the textbox? If there is more than one space it shows up like this: Family name: Given name:bob







