unit SystemStrLComp;

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: SystemStrLComp
// Routine: SysUtils.StrLComp

// BeginCode
{
This example requires two text edits and a button.
Enter text in the two text edits and click the button
to compare the strings.
}
procedure TForm1.Button1Click(Sender: TObject);
var
  S1, S2: String;
  Pos: Integer;
  Equal: Boolean;
begin
  Pos := 1;
  Equal := True;
  S1 := Edit1.Text;
  S2 := Edit2.Text;
  Form1.Repaint;
  while (Equal = True) do
  begin
    if StrLComp(PChar(S1), PChar(S2), Pos) = 0 then
      Inc(Pos)
    else
      Equal := False;
  end;
  Canvas.TextOut(10, 10, 'The first ' + IntToStr(Pos - 1) +
    ' characters are equal.');
end;
// EndCode
// EndExample: SystemStrLComp
end.
