Options: TextComparerOptions;
The Options property determines comparison parameters.
Options enables the user to compare taking into account the case and completeness of words.
To execute the example, add a link to the Collections system assembly.
Sub UserProc;
Function TestCompare(x: String; y: String): Integer;
Var
pComparer: IComparer;
FreeComparer: IFreeTextComparer;
iResult: Integer;
Begin
pComparer := Comparer.FreeTextComparer;
FreeComparer := pComparer As IFreeTextComparer;
FreeComparer.Options := TextComparerOptions.MatchCase Or TextComparerOptions.WholeWord;
iResult := pComparer.Compare(x, y);
Select Case iResult
Case 0: Debug.WriteLine("'" + x + "' '" + y + "' -> objects match");
Case - 1: Debug.WriteLine("'" + x + "' '" + y + "' -> partial match or occurrence is found");
End Select;
Return iResult;
End Function TestCompare;
Begin
TestCompare("Permskyy", "permskyy");
TestCompare("Permskyy", "perm");
TestCompare("Permskyy", "Permskyy");
TestCompare("Permskyy", "Perm");
End Sub UserProc;
After executing the example the console window displays results of the comparison taking into account the case and the completeness of words.
See also: