SystemStrEnd (Delphi)
Description
The following example uses an edit control, a label, and a button on a form. When the button is clicked, the text in the edit control is copied into a buffer. Then the buffer is displayed backwards in the label.
Code
procedure TForm1.Button1Click(Sender: TObject);
var
TextBuffer: PChar;
Ptr: PChar;
begin
GetMem(TextBuffer, Length(Edit1.Text)+1);
StrCopy(TextBuffer, PChar(Edit1.Text));
Ptr := StrEnd(TextBuffer);
Label1.Caption := '';
while Ptr > TextBuffer do
begin
Dec(Ptr);
Label1.Caption := Label1.Caption + Ptr^;
end;
FreeMem(TextBuffer);
end;
Uses
- System.SysUtils.StrEnd ( fr | de | ja )