Newbie wants to split up strings
Try to use the split function from the String object.
And return an Array from your function.
fullName = new String(fullName);
var namesArray = fullName.split("_");
return namesArray; // namesArray = firstName, namesArray = lastName
I'm looking for function that splits up a string into two i.e.:
Function called with
Fullname = "Alex_Shirley"
Firstname = "Alex"
Lastname = "Shirley"
Fullname = "Fred_Flintstone"
Firstname = "Fred"
Lastname = "Flintstone"
(The Fullname value will always have an underscore between the firstname and
What's the best way to go about this? Do I use the replace function. I've
looked through MSDN help and can't see anything that helps.