Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

spell checker 3

Status
Not open for further replies.

TheConeHead

Programmer
Aug 14, 2002
2,106
0
0
US
anyone know of a good spell checker? Like if I had an app where people enter text into a field and wanted to do a spell check on it.....

[conehead]
 
I am having trouble with this last section - then I will be done - what is this doing?

Code:
for each strSuggestion in Suggest
        dblSimilarity = WordSimilarity(strWord, strSuggestion)
        i = intSuggestionCount
        do while dblSimilarity > dblSimilarityArray(i)
            if i < intSuggestionCount then
                strSuggestionArray(i + 1) = strSuggestionArray(i)
                dblSimilarityArray(i + 1) = dblSimilarityArray(i)
            end if
            strSuggestionArray(i) = strSuggestion
            dblSimilarityArray(i) = dblSimilarity
            i = i - 1
            if i = -1 then
                exit do
            end if
        loop
    next

[conehead]
 
Specifically - what is this doing:

Code:
ReDim strSuggestionArray(intSuggestionCount)
ReDim dblSimilarityArray(intSuggestionCount)

intSuggestionCount is a number like 10 - so what is this doing? making an array with 10 memebers - but no value to those members?????

[conehead]
 
It is taking a so-called "dynamic array" and resetting its size to hold all the suggestions. In vb and vbscript "dynamic arrays" aren't really dynamic - they can't grow and shrink themselves. You have to redimension them to the size you need them to be before you can use the new elements.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
so you have to size it before you can add values to its members?

[conehead]
 
You do if you don't know beforehand how many members it is going to need to contain, and you don't want to have to size it to contain the largest possible number.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top