1) Create tokens from data, are garu suggested.
2) Insert those tokens into a vector
3) Call std::partition on the vector giving it your own comparison
3.a) You own comparison, could return true if the token is digit, thus separating digits from strings
4) From there you can proceed to go on further
Require your users to use specific input formats. Something like "M 36 John Doe Mary F 45" is nonsense at best and malformed otherwise. If you have two people then that should assume two inputs. If your user puts nonsense into the program, tell him!
So, You can assume one of the following by specifically restricting your user to:
Given Name, Surname, Age, and Sex, where the name is in one of the standard forms: "First Last" or "Last, First".
M 36 John Doe M 36 Doe, John
36 M John Doe 36 M Doe, John
M John Doe 36 M Doe, John 36
36 John Doe M 36 Doe, John M
John Doe 36 M Doe, John 36 M
John Doe M 36 Doe, John M 36
You can easily determine which is which by examining the type of the string.
If you have "M" or "F" or "Male" or "Female" or "m" or "f" or "male" or "female" or "MALE" or some other variation, then you know it represents the sex. If you have a number than it should represent the age. Otherwise it must be a name: If it ends with a comma (,) then it represents the last name -- otherwise it is given name. The next name item is either the surname or the given name, depending on what the first encountered name is.
There is a potential issue, mind you. Not all people have such simple names. Something like "Juaquin Antonio Carrera Hernandez III" is entirely possible. How will you parse that? What if he doesn't have a second given name, as in "Juaquin Carrera Hernandez III"? Is "Carrera" his middle name or his father's family surname? You can, of course, require that the input only have the first given name and the father's familial surname, which takes us back to the simple case above, but allows for potential conflicts for two people, say "Juan Cuevas Garcia" and "Juan Cuevas Castro" -- both would be listed as "Juan Cuevas".
See how this gets really obnoxious, really fast?
Do you have specific guidelines as to what kinds of input you can expect? Or can you require input to have a specific structure? Otherwise, you are pretty jacked and will have to rely on some heuristics to (hopefully) get it right most of the time.
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...