1 Replies - 301 Views - Last Post: 21 January 2014 - 07:19 AM Rate Topic: -----

#1 goodhamody  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 14-January 14

obtaining elements from each line of a text file.

Posted 20 January 2014 - 11:08 PM

Hello guys,

I have a text file that has the following information:

205000001001011514001Y  3361 #0001    N   0000000000ABCDEABCDE
205000002001011514001Y  3361 #0001    N   0112494360          
205000003001011514001Y  3361 #0001    N   0138641212BCDEABCDEA
205000004001011514001Y  3361 #0001    N   0123456789ABCDEABCDE


and I have the following code to read each line of the text file and store it in an array:
Dim lines() As String = IO.File.ReadAllLines(file)

            For Each line In lines
                
            Next



Note: File= text file path.

Now I want to obtain some elements from each line based on the start and end position of that element in the line. for example: I want to be able to take 0000000000 from first line and 0112494360 from second line and so on.

what method should I use to obtain these elements into an a new array from each line?

Is This A Good Question/Topic? 0
  • +

Replies To: obtaining elements from each line of a text file.

#2 ybadragon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 277
  • View blog
  • Posts: 1,467
  • Joined: 11-May 12

Re: obtaining elements from each line of a text file.

Posted 21 January 2014 - 07:19 AM

You could use Mid, or SubString to do what you are wanting. I would recommend using SubString.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1