From Clomosy Docs

Revision as of 08:09, 27 February 2023 by ClomosyManager (talk | contribs) (Created page with "The AnsiCompareStr function compares two string values ​​for equality. This is the modern, native safe form of CompareStr. All Ansi commands support multibyte and accented characters.<br> It returns these values: initialValue < secondValue : -ve number initialValue = secondValue : 0 initialValue > secondValue : +ve number The comparison is not affected by length - it is carried out on a letter by letter basis. But a longer string is greater than a shorter, oth...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The AnsiCompareStr function compares two string values ​​for equality. This is the modern, native safe form of CompareStr. All Ansi commands support multibyte and accented characters.

It returns these values:

initialValue < secondValue : -ve number
initialValue = secondValue : 0
initialValue > secondValue : +ve number

The comparison is not affected by length - it is carried out on a letter by letter basis. But a longer string is greater than a shorter, otherwise matching string.
The comparison is case sensitive.

Example:

var
MyForm:TFrmClomosyBasisForm; initialValue,secondValue : String; resultValue :Integer;
begin
MyForm := TFrmClomosyBasisForm.Create(Self); initialValue := 'Clomosy'; secondValue  := 'Clomosy';
resultValue := AnsiCompareStr(initialValue, secondValue);
if resultValue < 0 then ShowMessage(initialValue+' < '+secondValue); if resultValue = 0 then ShowMessage(initialValue+' = '+secondValue); if resultValue > 0 then ShowMessage(initialValue+' > '+secondValue);
MyForm.Run;
end;