Assuming your CSV-data is RFC4180-compliant, there's only a few things you need to take heed of:
- There is a special character that delimits fields (usually ,).
- There is a special character that delimits records (rows) (usually LF, but CRLF also tends to happen)
- When any of those special characters is used as data in a field, the field's data is surrounded by another special character (usually "). In such a case, any occurrence of this character (") in that same field's data needs to be doubled. (So any " in the data becomes "")
In order to be able to detect CRLF's in your data when reading the csv line-by-line, you only need to count the number of times the special character " occurs in the line read. If this is an odd amount, there was a CRLF in the data, and you need to continue reading lines until you encounter another line with an odd amount of "'s. Otherwise the data's all there.