unit str;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if (Edit1.Text > Edit2.Text) then
MessageDlg('A>B',mtInformation,[mbOk], 0)
else if (Edit1.Text = Edit2.Text) then
MessageDlg('A=B',mtInformation,[mbOk], 0)
else if (Edit1.Text < Edit2.Text) then
MessageDlg('A<B',mtInformation,[mbOk], 0);
end;
procedure TForm1.Button2Click(Sender: TObject);
VAR S:string;
Substr:string;
begin
S:=Edit1.Text;
Substr:=Edit2.Text;
Button2.Caption:=inttostr(AnsiPos(Substr, S));
end;
end.