Jump to content

Extract First Name from Full Name Field


Recommended Posts



I have a customer who has set up the name field in their database as "FIRSTNAME LASTNAME". Both first name and last name together in 1 field, separated by a space, all in caps.


I need to extract out the first name and convert it to proper case. I've created the following rule and it seems to work:


var Name = Field("Name");

var FirstName=Name.split(" ");

return ToTitleCase(FirstName[0]);

Link to comment
Share on other sites

It's probably the best way.


But it's not going to be 100 percent reliable. Sometimes the "first name" may have a space in it. Or at least, everything after the first name many not necessarily be the last name, such as "Billy Bob Thornton." Or you might have a name like "Roy Jones, Jr." where the last name is really Jones and the first name is "Roy Jr." Or you might have a title at the beginning, such as "Dr. John Doe." Or you could be dealing with Eastern names, such as Korean, where the "first name" is really last, after the family name.


Similarly, the ToTitleCase function doesn't always work, because not every person's name conforms to this standard. Consider names such as "Mies van der Rohe," or "Marty McFly," or "DeSean Jackson."


There's really no algorithm which allows a computer to reliably sort out all the variations for something like how a name is supposed to be formatted, since there are no hard-and-fast rules which are consistent around the world.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...