From Clomosy Docs

No edit summary
No edit summary
Line 15: Line 15:


  '''var'''<br>
  '''var'''<br>
   MyForm:TFrmClomosyBasisForm;
   MyForm:TclForm;
   initialValue,secondValue : String;
   initialValue,secondValue : String;
   resultValue :Integer;<br>
   resultValue :Integer;<br>
  '''begin'''<br>
  '''begin'''<br>
   MyForm := TFrmClomosyBasisForm.Create(Self);
   MyForm := TclForm.Create(Self);
   initialValue := 'Clomosy';
   initialValue := 'Clomosy';
   secondValue  := 'Clomosy';<br>
   secondValue  := 'Clomosy';<br>

Revision as of 14:26, 3 April 2023

function AnsiCompareStr(const String1, String2 string):Integer;

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:TclForm; initialValue,secondValue : String; resultValue :Integer;
begin
MyForm := TclForm.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;