lhanscom / ngx-csv

Helper library for create CSV file in Angular 7
MIT License
4 stars 5 forks source link

DecimalSeparator don't work. #11

Open jmmanzano opened 4 years ago

jmmanzano commented 4 years ago

I'm trying to use comma as DecimalSeparator but don't work. This is my options object. protected options = { fieldSeparator: '\t', decimalseparator: ',', showLabels: true, showTitle: false, useBom: false, noDownload: false, headers: [] };

I have modified the ngxCsv.isFloat method to detect the float numbers with a regex: That is my overwrite isFloat method: ngxCsv.isFloat = function (input) { const regex = /^([+|-]?\d+.\d+\b)/; return regex.exec(input) !== null //return +input === input && (!isFinite(input) || Boolean(input % 1)); };