StrECopy (Object Pascal)

From Appmethod Code Examples
Jump to: navigation, search

Description

This example uses a button on a form. Since StrECopy returns the destination char array, nested calls are possible and actually more efficient than repeated calls. StrECopy does no bounds checking. When the button is clicked, the inline text is appended to a static buffer. Then the buffer is displayed in the form's canvas.

Code

procedure TForm1.Button1Click(Sender: TObject);
const
  Turbo: PChar = 'Object';
  Pascal: PChar = 'Pascal';
 var
  S: array[0..15] of Char;
begin
  SysUtils.StrECopy(SysUtils.StrECopy(SysUtils.StrECopy(S, Turbo), ' '), Pascal);
  Canvas.TextOut(10, 10, string(S));
end;

Uses