How to return the first word in a given string

Hi Community!

Is there a way to return the first word in a string?

For example, lets say a mailhook needs to check the first word in the subject line of an email.
e.g. “ABC100 - some more text”
how to extract ABC100 to use in a subsequent lookup?
I’ve tried using substring() however the length of the 1st word can vary. I’ve tried using the first(split()) to find the “-” and then grab the first word from the created array but I cannot rely on a “-” char being entered in the subject line… e.g. subject: “ABC100 some more text”

I’m sure there’s a simple solution here :slight_smile:

Thanks!

You can use the built-in function split

e.g.:

{{ first(split("ABC100 - some more text"; space )) }}

Screenshot_2024-05-31_210524

For more information, see string functions in the help center.

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

General

Help Center Basics

Articles & Videos

samliewrequest private consultation

Join the unofficial Make Discord server to chat with other makers!

2 Likes

Thanks you samliew. that worked! I didn’t see the SPACE keyword. lovely!

2 Likes