Saturday, September 15, 2012

Membalik Text

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    B1: TButton;
    procedure B1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

function RS(const AText: string): string;
var
  I: Integer;
  C: PChar;
begin
  SetLength(Result, Length(AText));
  C := PChar(Result);
  for I := Length(AText) downto 1 do
  begin
    C^ := AText[I];
    Inc(C);
  end;
end;

procedure TForm1.B1Click(Sender: TObject);
begin
   Form1.Caption := RS(Form1.Caption);
   B1.Caption := RS(B1.Caption);
end;

end.

No comments:

Post a Comment