CompareText compares the given strings S1 and S2, and returns zero (0) if they match.

CompareText is not sensitive to case in its comparison - A is taken as the same as a.

The function will return 1 if -

  • S1 is less than S2 (alphabetically)

  • S1 is greater than S2 (alphabetically).

Declaration: Function CompareText( const S1, S2 : string) : Integer

Here is an example.

procedure OnMapEvent(var Value:Variant);
begin
//The test would return true
If CompareText('abc','ABC')= 0 then
LogInfo('The strings match each other.')
else
LogInfo('The strings do not match each other. Try again!');
//The test would return false
If CompareText('Apples','Apple')= 0 then
LogInfo('The strings match each other.')
else
LogInfo('The strings do not match each other. Try again!');
//The test would return false
If CompareText('apples','oranges')= 0 then
LogInfo('The strings match each other.')
else
LogInfo('The strings do not match each other. Try again!');
end;