Chrusion
gold plated 3D
I have a comma delimited file (CSV) in which a few cells have no data (nil). When using the parse method in my script, the returned token for that line is compressed. That is, parsing the line ",,2.5,5.1" results in the token array of "2.5,5.1,," An input of "101,,,404" results in "101,404,," etc.
IOW, parse has a fatal flaw (maybe by design, but WHY?) in that it ignores nil cells and shifts the next non-nil cell in to the next available cell in the token array, instead of keeping it as per the data set with nil cells in between non-nil data. This malformation of the token array obviously breaks my script that checks for nil data that's expected to be in cells [1 and 2]. I have no control of the generation of the CSV file.
How can this be worked around? Because, suppose a CSV file has 2.5 million lines and is generated from an on-line database search/retrieval system, how would you instruct someone getting such files to use in my script and how would they even know that the data needs to be edited to "fix" it when you have no idea who they are or when they will use the script? It would be far better to have a parser that simply leaves a token cell nil when nil data is found at each separator character and NOT shift non-nil values downward, compressing the token array.
IOW, parse has a fatal flaw (maybe by design, but WHY?) in that it ignores nil cells and shifts the next non-nil cell in to the next available cell in the token array, instead of keeping it as per the data set with nil cells in between non-nil data. This malformation of the token array obviously breaks my script that checks for nil data that's expected to be in cells [1 and 2]. I have no control of the generation of the CSV file.
How can this be worked around? Because, suppose a CSV file has 2.5 million lines and is generated from an on-line database search/retrieval system, how would you instruct someone getting such files to use in my script and how would they even know that the data needs to be edited to "fix" it when you have no idea who they are or when they will use the script? It would be far better to have a parser that simply leaves a token cell nil when nil data is found at each separator character and NOT shift non-nil values downward, compressing the token array.
Last edited: