Text manipulation is a tough skill to achieve in Bubble, but mastering it will help you elevate your workflows to the next level. This week, learn to supercharge your Bubble toolbox with a collection of assorted tips and change the way you interact with texts.
1. Arbitrary text
Ever tried to put a text with multiple lines into one input box but it simply refuses to take in a new line?
With the arbitrary text operator, you can structure multi-line texts with new lines. You also get a bigger box where you can edit your values much more easily.
2.Formatted as operator
Most people know how to use the formatted as operator to convert dates into a custom format. However, many do not know that it can also be used for boolean (yes/no) values.
It can be very useful to specify values that you want to send through the API or display to your user depending on the yes/no condition, which would take duplicate workflow steps if you are using the 'only when' condition.
One way I really like using it is to combine with the ’is empty‘ operator to store values based on whether an input is empty or not empty.
This is a free plugin that allows you to format your inputs. It formats your input box automatically as the user types and this can be most useful for cleanly formatting credit card numbers, dates, numbers and more.
Note that the plugin has been deprecated and not maintained. So far, it is still useable but you may have to transition to other options in the future.
4. Find and Replace
The 'find and replace' operator allows you to replace those pesky spaces or symbols that may be messing up your inputs. I normally use this for removing spaces or new lines.
Users who want more advanced logic to replace certain/multiple characters can consider using regex in the following tip.
A regular expression(regex) is amazingly powerful in searching and manipulating text strings. It is used to locate certain strings of text/characters and is more flexible than the find and replace function.
The one obstacle to using it is the scariness of how it looks:
However, using ChatGPT is my favourite method to build out the regex. It is so easy now! Take a look at the interactive video below on how you can build your own regex expression: