How to Format Number

Hi

Need help to format a number

24555333000141 entered in a form

Formated as
24.555.333/0001-41

regards,
Paulo Novas

5 text slice and a template column but Iā€™d probably ask chat GPT for a little Java script

1 Like

Javascript with regex pattern would better. I tried using template with pattern matching first. It requires too much work.

return p1.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/, "$1.$2.$3/$4-$5")
1 Like

Hi Raajkumars,

Thanks, i do not know if i did it right, got an error

Please convert it to a string first:

return p1.toString().replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/, '$1.$2.$3/$4-$5');
3 Likes

I am sorry. I assumed that you are storing that long number as a string. if it is a number then you have to convert it to a string as suggested by @ThinhDinh

1 Like

Hi

Many thanks, working perfect!

regards,

2 Likes