我需要删除“总收费”列中的千位逗号分隔符 (,)。目前我正在使用
line = line.replace(',', '');
但随后它将删除所有逗号。
有什么建议我们可以在 JavaScript 中删除千个逗号而不删除分隔符逗号吗?
文件是csv格式,但可以在记事本上查看
示例:
原样
"Modem ID","Total Chargeable"
"BF002062010","1,300.00"
"BF002062013","1,900.00"
"VV878443","1,000.00"
"","2,200.00"
"BF002061500","5,300.67"
"BF002062151","2,000.00"
未来
"Modem ID","Total Chargeable"
"BF002062010","1300.00"
"BF002062013","1900.00"
"VV878443","1000.00"
"","2200.00"
"BF002061500","5300.67"
"BF002062151","2000.00"
加回逗号。
line.replaceAll(',', '').replace('""', '","')