I need to format a number in JavaScript with separators that may be defined at runtime.
The combination of thousand and decimal separator may not match a specific locale.
Is there a way to provide the thousand and decimal separator in JavaScript toLocaleString()
? or to use NumberFormat
explicitly with values I define?
I see examples using locale codes, and some using other values ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString ) but these don't cover my use case.
,
,.
and space, it's possible to detect the correct combination at runtime, and pick a suitable language tag. Or are the delimiters fully custom, likea
,x
etc.? – Ferdelance