Hey, I want to split the name output into first and last name, how can I do that? which functions should I use
This should be strait forward.
you can split the string using IML at the “space” Between the names. and take 1st slot in the returned array for the first name, and 2nd slot for the last name.
this is more complicated if middle name or initial is included, or worse, if names have an inconsistent format.
let me know if you need more details than this i can provide some visual examples
I would love to get visual examples, I don’t know what IML means as well
everything in this box each tab.
First Module sets an example name.
2nd module splits the name into an array of individual words.
then grabs the first in array as the first name
and the last in the array as last name,
This is the final result
Note, this is the simple version. you may have to account for “jr” after the last name, or middle initials. i do not off the top of my head know how stripe sends that data. Regular expressions or more complex IML should be able to handle more variance.
there are also cultural name formatting differences if you have to account for internationalization.
Hope this helps
Thank you @alex.newpath !
This is really a great example of an explanation. You’ll probably have some edge cases like 3 names or more so you’ll need to explore regular expressions I think. Have a look at regex101.com and their library of common regular expressions.
Thank you so much Jugaadhi, btw I have 3 follow up questions
#1 Instead of creating a “set multiple variable” and adding the function there.
why don’t I add the same function in mailchimps first and last name field, will it work
#2 I saw a youtube video and they used this function, will that work as well
#3 what about splitting when a middle name is there, what can we do
should also work, there are generally many different solutions to the same problem.
once you learn the basic patterns it mostly applies the across the platform on the majority of integrations.
See @alex.newpath links and extended solution in the post above yours it has links to resources on how to use regular expressions in