I am using the following function to parse a CSV file into an array of strings. The function works fine, but all of the values in the resulting array of strings are surrounded by double quotes. I wanted to find an efficient way to strip the surrounding quotes from string values in the resultant array. Im pretty sure I can do this by modifying the regular expression, but not positive.
Private Shared Function ParseLine(ByVal oneLine As String) As String()
Dim r As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex(",(?=(?:[^""]*""[^""]*"")*(?![^""]*""))")
Right now, I am using the following code on the resultant array, which takes a long time and is obviously very inefficient:
Dim i As Integer
For i = 0 To parsedString.Length - 1
dataStore(recordCount - 1, i) = parsedString(i).Substring(1, parsedString(i).Length - 2)
Thanks in advance. Cheers to whoever can do this :-)