DEV Community

Discussion on: Counting zero's sucks!!

Collapse
mellen profile image
Matt Ellen • Edited on

Have you tried toLocaleString? That also solves the problem of knowing when to use , as the decimal point and . as the thousands separator.

Collapse
mwasigala profile image
Caroline Mwasigala Author

Hello Matt , thanks for pointing this out, yes i tried using it but didn't get the flexibility that was needed on the input field. It formatted the number but it took control of the cursor, that's why i opted regex.

Collapse
mellen profile image
Matt Ellen

Thanks for the insight.