ben-strasser/fast-cpp-csv-parser

Can ^M at end of line be trimmed

Closed this issue · 3 comments

CSVReader<3, trim_chars<' ', '\t', '\r', '\n', '^M'>, no_quote_escape<','>, throw_on_overflow, no_comment> in(strFileName.c_str());

I have give n above directive but with below csv file,
^M
1256,3647,172.70.108.65^M
1276,3098,172.29.123.233/r
1234, 5678, 172.70.109.25

I was expecting ^M, \r to be trimmed and use other data but it is not working as desired.
Can you pls help me with correct directive

^M comes when csv file from Windows to linux is copied.
Actually I don't need ^M removal /ignorance/trim but somehow "\r" is being treated as new line, is there a possibility to be treated in same line where it is physically placed ?
I mean
^M
1256,3647,172.70.108.65^M
1276,3098,172.29.123.233/r
1234, 5678, 172.70.109.25
3954,2653,172.20.234.231\n
1265,2643,173.45.54.321\r
1236, 5680, 172.70.109.25
2222, 678, 172.70.109.25
222, 785432, 172.25.217.218

here ^M is treated invalid/exception but first /r ( LN#3) is treated at LN#4, I would like it to be treated at LN#3 itself as invalid/exception

closing as I got the solution