Split using Website Text

Hello! I have a snippet that grabs a first and last name on a site and I'd like to split so that it just shows the first name. Here is the snippet that pulls first and last:

Hi {site: text; selector=.title > .name},

So it will display "John Smith" and I'd like for it to display "John". Any help is appreciated. Thank you!

Hi Logan,
Try {=split({site: text; selector=.title > .name}, " ")[1]}

Thank you so much, Dan! You actually showed this to me on our call but I couldn't figure out the exact syntax for this one. Really appreciate it!

1 Like

Hi @log62000

Dan's suggestion is a perfect fit, but if you'd like to learn a few more tricks on how to manipulate content, I suggest checking out the recording of the Advanced Masterclass we had last week.

Here's the link to the page with the video and all of the snippets I featured in the class: Masterclass Notes

And of course, if you have any questions, ask away! :slight_smile:

Yes! I remember this on the masterclass call which was awesome btw thank you for doing that! Y'all are so helpful. Really appreciate it!


Is there a way to format this same snippet so the information extracted is in proper format with a capital letter?

1 Like

Hi @Jennifer_Saavedra Welcome to the forum! :slight_smile:

You can use proper function:

{name="jOhN SMITH"}
First name: {=proper(split(name, " ")[1])}
Last name: {=proper(split(name, " ")[2])}

Plugging this into Dan's snippet:

{=proper(split({site: text; selector=.title > .name}, " ")[1])}

Let me know if it works for you.

1 Like

Thank you so much @Gaurang_Tandon! This worked perfectly!