Extract each digit of a number

I have a custom value that is a number (e.g. “199”). I need to extract each of the digits (“1”, “9”, “9”) to display them on a different text element (the “1” on one element, the “9” on another element, and the “9” on another element).

Is there a way to do this? I was thinking of using regex, but not sure how I can do it :confused: Thanks!

you can use Javascript to Bubble plugin & execute it there using javascript & return a list of integers.

1 Like

Which exact JS code do I have to use to make this happen? :slight_smile:

Are the number of digits dynamic or is just 3 digits max?

Are the number of text elements dynamic i.e. in an RG or is it fixed?

Use the Bubble native operator:extract with regex (regex pattern = \d)

If the input type is number, use input's value :formatted as 199:extract with regex

1 Like

It’s a big number, for now 11 digits, like this: 204199200

So I’d need to take each of those 11 digits to display each of those on a different text element

This worked like a charm :slight_smile: Thanks a lot!

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