|
|
Topic complex |
String functions |
Function |
strcomp() |
Short |
compares two strings |
Syntax |
STRCOMP(s1, s2 : STRING) : REAL |
Parameter |
s1, s2 : any strings |
Return |
0 : s1 and s2 are totally different
1 : s1 and s2 are equal (case-insensive)
otherwise a "value of similarity" of both strings |
See also: |
|
Description |
Returns a relative comparison of two strings. The result is 0 if both strings are different in every character and 1 if they are absolutely equal. In every other case a value between those is arisen which is the higher the more fragments of one string can be found in the other one. The exact formel is:
StrComp(S1,S2) = 2*n/(Length(S1)+Length(S2))
whereas n is the number of equal charakters (directed from left to right).
String1 String2 same charakters StrComp
---------------------------------------------------------
Hinterhuber Einmeier 5 0.53
^^ ^ ^^ ^^ ^ ^^
Sindelfingen Sindlefingen 11 0.92
^^^^ ^^^^^^^ ^^^^^ ^^^^^^
Huberstraße Albertusstr 6 0.55
^^^^^^ ^^^ ^^^
This function is very well qualified to find the most similar string to an other in a table.
|
Write a comment:
|
|
|