: lngMaxLen - ( ), strStringMatching- , strStringStandart - , lngCase - ( )
:
: 0 100 ( 0 - , 100 - ).

PublicTypeRetCount
lngSubRowsAsLong
lngCountLikeAsLong
EndType

PublicFunctionIndistinctMatching(lngMaxLenAsLong,strStringMatchingAsString,strStringStandartAsString,lngCaseAsLong)AsLong
DimgretAsRetCount
DimtretAsRetCount
DimlngCurLenAsLong

IflngMaxLen=0OrLen(strStringMatching)=0OrLen(strStringStandart)=0Then
IndistinctMatching=0
ExitFunction
EndIf
gret.lngCountLike=0
gret.lngSubRows=0
ForlngCurLen=1TolngMaxLen
tret=MatchingStrings(strStringMatching,strStringStandart,lngCurLen,lngCase)
gret.lngCountLike=gret.lngCountLike+tret.lngCountLike
gret.lngSubRows=gret.lngSubRows+tret.lngSubRows
tret=MatchingStrings(strStringStandart,strStringMatching,lngCurLen,lngCase)
gret.lngCountLike=gret.lngCountLike+tret.lngCountLike
gret.lngSubRows=gret.lngSubRows+tret.lngSubRows
NextlngCurLen
Ifgret.lngSubRows=0Then
IndistinctMatching=0
ExitFunction
EndIf
IndistinctMatching=(gret.lngCountLike/gret.lngSubRows)*100
EndFunction

PublicFunctionMatchingStrings(strAAsString,strBAsString,lngLenAsLong,lngCaseAsLong)AsRetCount
DimtretAsRetCount
DimyAsLong,zAsLong
DimstrtaAsString
DimstrtbAsString

Forz=1ToLen(strA)-lngLen+1
strta=Mid(strA,z,lngLen)
y=1
Fory=1ToLen(strB)-lngLen+1
strtb=Mid(strB,y,lngLen)
IfStrComp(strta,strtb,lngCase)=0Then
tret.lngCountLike=tret.lngCountLike+1
ExitFor
EndIf
Nexty
tret.lngSubRows=tret.lngSubRows+1
Nextz
MatchingStrings.lngCountLike=tret.lngCountLike
MatchingStrings.lngSubRows=tret.lngSubRows
EndFunction


- . , 0 1. 0 , 1 - ( ) .
. , , "test" "text" , , 4. . , , .

.

?

test text 1.

t

t, e, x, t

3

4

e

t, e, x, t

s

t, e, x, t

t

t, e, x, t

text test 1.

t

t, e, s, t

3

4

e

t, e, s, t

x

t, e, s, t

t

t, e, s, t

test text 2.

te

te, ex, xt

1

3

es

te, ex, xt

st

te, ex, xt

text test 2.

te

te, es, st

1

3

ex

te, es, st

xt

te, es, st

test text 3.

tes

tex, ext

0

2

est

tex, ext

text test 3.

tex

tes, est

0

2

ext

tes, est

test text 4.

test

text

0

1

text test 4.

text

test

0

1

8

20

. "test" "text" , 4, , 8/20, 0,4. , : , 6/8 0,75. , , 4, : , .
(, , ). , . , , 2-3.

:

1.
IfIndistinctMatching(4,"test","TEXT",vbBinaryCompare)>40Then...
2.
IfIndistinctMatching(4,"test","TEXT",vbTextCompare)>40Then...


 http://www.interface.ru
 http://www.interface.ru/home.asp?artId=8900