How can I check the first letter of a string for a vowel?

Hello!

I am looking to adjust a text element based on the first letter of a dynamic word. In French, if the first letter is a vowel, I need to adjust the article (eg, “le chat” is good, “le oiseau” is not, I need to write “l’oiseau”).

Is there an operator in Bubble which allows to extract the first letter of a string?

Thanks in advance!

Hi there, @jonathan.pinet… one way you can do what you described is to use the :truncated to operator to truncate the string to 1 character and then compare that character to a list of vowels to see if the character is in the list.

Hope this helps.

Best…
Mike

Thanks for your answer @mikeloc ! It’s working from my end.

One thing though: it seems to be case sensitive, which means I need to account for every lower and upper case :frowning:

1 Like

One thing though: it seems to be case sensitive, which means I need to account for every lower and upper case

No you don’t, just keep the list you’re referring to in lowercase, and use :lowercase on the truncated string you’re comparing it to.

1 Like

Nice trick! thanks @adamhholmes

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.