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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Spacing in INI files 2
.ini File 2
INI Files 4
Using an xml file in place of a .ini 6
ini File? 5
txt files 2
Including INI file in Services Deployment 1
Reading from a ini-file and run a program 3

Back
Top