CSV with \ n \ r in lines - how to determine the end of a line? `
I have a very large CSV with 244 columns and 4000 rows. There are many \ n \ r, so when I try to split it into this (to find the end of the line) I get about 9000 lines instead of the 4000 I want.
So how do you determine which \ n \ r is in the text, or maybe at the end of a cell, and which is the final end of the line?
source to share
When a CSV file has data in a column that is \ n, \ r, or, quotes are usually placed around these values. To edit the CSV correctly, I would recommend the already existing parsers. See this answer for an example.
If you really want to be yourself, you need to write a simple state machine that reads data on individual columns. You must follow the evacuation rules when reading the column. This is the only way you could distinguish between line endings in data and line endings that highlight lines.
source to share