0

I'm trying to parse a long boring text document and parse and format it.

"7/29/2012 1:25:20 PM","Summary Plan/Second Floor /Master_VAV_2-24","Source :OEnd"
"7/29/2012 11:25:23 AM","Summary Plan/Second Floor /Master_VAV_2-24","Source :OStart"

I'd like to parse each value between the quotes but I cant find anything online to help me, I believe it's a matter of knowing what to call it and search for.

"date", "location", "type" would be the 3 values I want to parse it into, then I could run a loop for each item in datatable and format it as required.

ANY HELP would be great, thank you!

I'm thinking of using RegEx to get the rows and add them manually to an array, something like this.

Dim rx As New Regex(",", RegexOptions.IgnoreCase Or RegexOptions.Multiline)
Dim matches As MatchCollection = rx.Matches(strSource)
For Each match As Match In matches
Dim matchValue As String = match.Value
If Not list.Contains(matchValue) Then
    list.Add(matchValue)
End If
Next

1 Answer 1

3

This format appears to be CSV - use one of the many free and open source CSV parsers (google ".NET CSV parser" will return many results.

There is one that comes built in, in the Microsoft.VisualBasic.FileIO namespece - the TextFieldParser.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.