Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Currency Style solution in Clear category for Currency Style by ddavidse
function magic(line) {
let line1 = line.replace(/(\d+)\.(\d{3})/g, '$1,$2')
let line2 = line1.replace(/(\d+)\.(\d{3})/g, '$1,$2')
let line3 = line2.replace(/,(\d{2})(?!\d+)/g, '.$1')
return line3
}
var currencyStyle = line => (line.split('\.').every(x => /^\d+$/g.test(x))) ? line
: line.split(' ').map(magic).join(' ')
Jan. 18, 2021
Comments: