StrComp (Delphi)
Description
The following example uses two edit controls and a button on a form. When the button is clicked, the text in the edit controls is compared.
Code
procedure TForm1.Button1Click(Sender: TObject);
var
Msg: string;
CompResult: Integer;
begin
Msg := Edit1.Text;
CompResult := SysUtils.StrComp(PChar(Edit1.Text), PChar(Edit2.Text));
if CompResult < 0 then
Msg := Msg + ' is less than '
else if CompResult > 0 then
Msg := Msg + ' is greater than '
else
Msg := Msg + ' is equal to ';
Msg := Msg + Edit2.Text;
ShowMessage(Msg);
end;
Uses
- System.SysUtils.StrComp ( fr | de | ja )