Is it possible to display a number with a leading 0?

I am displaying a calculation on a page, where the result is either a single digit or double digit number. However, I want to always show two place values. Example below.

1 should be shown as 01
8 should be shown as 08
19 should be shown as 19

Is there a way to format the result so that a single digit will have a leading 0?

add the following after your number:

formatted as: number → find & replace → checkmark use a regex pattern → regex pattern: \b(\d)\b → replace by: 0$1

2 Likes

Well… there’s no such thing as the number 01 (that’s just the number 1)….

But if you’re want to to display a single digit number as a two character text, one simple way is to start with the character ‘0’ then append your number.

Then truncate from end to 2.

That way the number 1 will be appended to 0 to output 01, and the number 14 will be written as 014, truncated from end to 2, which will output 14.

love this idea but unfortunately Bubble still displays it at a single digit after applying the regex pattern.

Edit. I figured it out, I adjusted the argument and it worked. thanks

1 Like

Did you change the reflex argument from the above suggestion?

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