Wath is really fast mid or instr

User avatar
sal21
PlatinumLounger
Posts: 4473
Joined: 26 Apr 2010, 17:36

Wath is really fast mid or instr

Post by sal21 »

I loop a txt file line by line with the tipical:

File = FreeFile
Open "C:\TEMP\TABULATI_132.TXT" For Input As File

While Not EOF(File)

Line Input #File, strFileLine
....

wend

and check string with INSTR but i'm sure not is a very good Fasetd method....
Pearph i need the MID statement ineatsted?

note:
in my txt file are presents many blank line and i skip with the ...if len ...>0 then
my txt file in the simple case can have approx 300.000 or 400.000 lines :sad: :scratch:
Last edited by sal21 on 24 Mar 2011, 23:36, edited 1 time in total.

User avatar
HansV
Administrator
Posts: 79317
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Wath is really fast mid or instr

Post by HansV »

It depends on what you want to check...
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4473
Joined: 26 Apr 2010, 17:36

Re: Wath is really fast mid or instr

Post by sal21 »

HansV wrote:It depends on what you want to check...
leght of string chek, type numbers or lketters or wath?

haaaaaaaa... i write the result in a acess database with

rs.addnew
...
rs.update

User avatar
HansV
Administrator
Posts: 79317
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Wath is really fast mid or instr

Post by HansV »

If you want to extract text from a specific position in the line, it's best to use Mid.
If you want to test whether a specific text string occurs in the line, it's best to use InStr.
Best wishes,
Hans