File "Contains" method
Posted on 2007-08-09
I'm searching a text file for any instance of a string using the myfile.Contains("mystring") method. The file is a simple text file, containing one word per line and then the next word follows on the next line after that, and so on to the EOF. However, I'm running into the situation where if I'm searching for something like the string "write", I'm also finding it in the word "rewrite" as well. Clearly, "Contains" simply searches the file and determines if the string is contained therein.
1). How can I force the Contain method to begin at the start of each line.
2). How can I tell it that I do not want sub-strings contained in larger stings.
-- Both solutions would work and for my edification, if you can explain both I'd appreciate it.
Since this is a two part question, I'm adding the Max points possible for your efforts.