unit StrComp;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: StrComp
// Routine: SysUtils.StrComp

// BeginCode
{
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.
} 
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;
// EndCode
// EndExample: StrComp
end.
