I have a list of people's name and dates in a string, each separated by a comma:
"john 01/01/2000, tom 01/07/2010"
Using IndexOf, I'm able to check a person's name against this list. But I want to return their date and not just whether they're on the list or not.
Using "john" as an example, my theory is that I get the length of the name "john", add 1 character to it and then use a MID equivalent function that will put the next 10 characters into a variable and this will be the date. My pseudocode in the last line needs to be fixed, can someone please help? Many thanks in advance
var people='john 01/01/2000, tom 01/07/2010';
var theposition = people.indexOf('john');
if (theposition >= 0 ) //name is found
var namelength = 'john'.length + 1;
var returndate = mid(people,(theposition + namelength),10);