fpena06
fpena06

Reputation: 2426

Split string? vb.net

Can someone please point me in the right direction. I have a simple vb.net application that converts PDF to txt and reads line by line to create a csv file. The original Pdf has changed and I need to modify my code. For example from the line below how could I extract or split each category? For example just the xxxxxxxx for tech ID, DOE JOHN and xxxxxxxx from account number?

line =  "Tech ID: xxxxxxxxxx Name: DOE, JOHN Account #: xxxxxxxx"

Upvotes: 2

Views: 1401

Answers (1)

Matt
Matt

Reputation: 14531

You could use the Split method:

Dim line As String = "Tech ID: xxxxxxxxxx Name: DOE, JOHN Account #: xxxxxxxx"
Dim separators() As String = {"Tech ID:", "Name:", "Account #:"}
Dim result() As String
result = line.Split(separators, StringSplitOptions.RemoveEmptyEntries)

Upvotes: 3

Related Questions