Vb6: tab delimited separator text

I have a file with several thousand rows and several columns separated by tabs. What I would like to do is cycle through them individually. Put the columns in an array so that I can put them in another application separately, and then move on to the next line. Unfortunately, I got to this:

Open mytextfile.txt For Input As #FileHandle
 Do While Not EOF(FileHandle)
 Line Input #FileHandle, IndividualLine
 StringToBreakup = IndividualLine
Loop

So, how can I change the breakdown of a single row into an array

+3
source share
2 answers
Dim str() as String

Open mytextfile.txt For Input As #FileHandle
    Do While Not EOF(FileHandle)
    Line Input #FileHandle, IndividualLine
    str = Split(IndividualLine, vbTab)
    Debug.Print str(0)  'First array element
Loop

To clarify: I would avoid using Options and use vbTab.

+5
source

Use the split command

Dim StringArray as Variant

Open mytextfile.txt For Input As #FileHandle
 Do While Not EOF(FileHandle)
 Line Input #FileHandle, IndividualLine
 StringToBreakup = IndividualLine

 StringArray = Split(StringToBreakup, CHR(9)) 

 Process array here...

Loop
0
source

Source: https://habr.com/ru/post/1699591/


All Articles