I have a following list of names:
List<string> names = new List<string>(); names.Add("Tom Example"); names.Add("Ron Example"); names.Add("Peter Pavel Example"); names.Add("Pavel Ron Tom Example");
I want to split string in smaller strings for each element of list:
string firstName; string firstInitial; string lastName; string lastInitial; string secondName; string secondInitial;
I want do this method in loop becouse I want to do some things on that small strings. And if I have 3 names and surname in string I want to have only first and second name and surname. For clearance:
For last element of list I want to have that result:
string firstName == Pavel; string firstInitial == P; string lastName == Example; string lastInitial == E; string secondName == Ron; string secondInitial == R;
I have no idea how to implement this problem to work correctly. Any ideas?