I've been given a large file with a funny CSV format to parse into a database.
The separator character is a semicolon (;
). If one of the fields contains a semicolon it is "escaped" by wrapping it in doublequotes, like this ";"
.
I have been assured that there will never be two adjacent fields with trailing/ leading doublequotes, so this format should technically be ok.
Now, for parsing it in VBScript I was thinking of
- Replacing each instance of
";"
with a GUID, - Splitting the line into an array by semicolon,
- Running back through the array, replacing the GUIDs with
";"
It seems to be the quickest way. Is there a better way? I guess I could use substrings but this method seems to be acceptable...