Checking occurances in a txt/ini file

  • Thread starter Thread starter Adam Honek
  • Start date Start date
A

Adam Honek

In VB.Net is there a simple quick way to check how many
occurances of a phrase (ie "xxx") there is in a txt or ini file
or must we do it the long fashioned way of reading through
the entire file one line at a time?

Thanks,
Adam
 
You don't have the read the entire file one line at a time, but you
could read it in one go, using the ReadToEnd() method.

Then you could call the IndexOf method in a loop, and increment the
start position of this method with each iteration.

Is that too Long-fashioned ?

Regards,

Cerebrus.
 
Cerebrus said:
You don't have the read the entire file one line at a time, but you
could read it in one go, using the ReadToEnd() method.

True, but I'd only do that for small files...
 
Back
Top