Re: Search using a list of words
- From: "Mike Williams" <mike@xxxxxxxxxxxxxxxxx>
- Date: Wed, 27 Jun 2007 13:58:01 +0100
"Flintstone" <ratcliffe_mike@xxxxxxxxxxx> wrote in message
news:1182938498.674186.144760@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am looking for a way to search a project using a list of
words (contained in a file) and display a list of the words
I have not used. I want to search a whole project (stored
locally) and find out which words from the list I have not
used. So if my project contained the words txtString1 and
txtEnglish3 then the utility should output txt2. Does anybody
know of an existing utility that can accomplish this?
You've already got such a utility. It is called VB6. All your main projects
files contain standard Ascii text and so it would be very easy to load them
into a String in VB and use the Instr function to search that string for
each of the 8000 words in your list and flag up those that it doesn't use
(which will probably be quite a lot of them!). Since you're checking against
up to 8000 different words then it would probably be best to convert the
string containing the loaded project file to upper case and to have your
list of search words also in upper case. That will allow you to use
BinaryCompare instead of TextCompare and would speed it up a lot (unless of
course case sensitivity is important to you for some reason). You would need
to check the characters immediately before and immediately after the "found
word" of course to ensure that it was not part of a longer word (checking
perhaps for a comma or a space or a CrLf) but that wouldn't slow it down
very much. Even such a simple solution using Instr would be quite fast, and
you would probably be able to process even a fairly large set of project
files (50K or so) in a couple of seconds even with your long list of 8000
words to check. You could no doubt speed this up further by loading the file
into a Byte array instead of a String and searching through the raw byte
data using standard integer comparisons, which would allow you to use a more
efficient search algorithm than the one used by Instr, but I don't think
you'll need to go to all that trouble and I think you'll find Instr fast
enough for your needs.
Mike
.
- Follow-Ups:
- Re: Search using a list of words
- From: Flintstone
- Re: Search using a list of words
- References:
- Search using a list of words
- From: Flintstone
- Search using a list of words
- Prev by Date: Re: webbrowser and postdata.
- Next by Date: Re: How to use the Trim function?
- Previous by thread: Re: Search using a list of words
- Next by thread: Re: Search using a list of words
- Index(es):
Relevant Pages
|