I am extracting names like this, Doe, John. I need to convert this to John Doe:
My JavaScript gatherer, with limited knowledge on Javascript. And using your built in text-gatherer feature I was able to code this:
Code: Select all
//returns the first name, using the space as the delimiter
var step0_result = element.innerText.replace(/\r\n/g, "\n");
var step1_slices = step0_result.split(" ");
var step1_result = step1_slices[1];
//returns the last name, using the comma as the delimiter
var step2_result = element.innerText.replace(/\r\n/g, "\n");
var step3_slices = step2_result.split(",");
var step3_result = step3_slices[0];
//Now I need sorted, on the return like so, but this doesn't work
return [step1_result,step3_result];
However, when using :
Code: Select all
return step1_result;
Code: Select all
return [step1_result,step3_result];
How do I code this to work , and return John Doe? Or maybe i'm on the wrong track altogether. Or maybe there is a another solution using a different javascript?