CompareStr (Delphi)

Contents

Description

The following code compares String1, 'STEVE', to String2,
'STEVe'. Note that CompareStr returns a number less than 0
because the value of 'e' is greater than the value of 'E'.

Code

procedureTForm1.Button1Click(Sender:TObject);varString1,String2:string;I:Integer;beginString1:='STEVE';String2:='STEVe';I:=SysUtils.CompareStr(String1,String2);{ The value of I is less than 0. }Edit1.Text:=InttoStr(I);ifI<>0thenMessageDlg('The strings are not equal',mtWarning,[mbOK],0)end;