DelphiBasics
DupeString
Function
Creates a string containing copies of a substring StrUtils unit
 function DupeString ( const Source : string; Count : Integer ) : string;
Description
The DupeString function creates a string containing a sequence of Count copies of a Source string.
Related commands
StringOfChar Creates a string with one character repeated many times
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : A simple example
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  StrUtils,   // Unit containing the DupeString command
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

var
  myString : AnsiString;
begin
  myString := DupeString('Hello ', 3);

  ShowMessage('myString = '''+myString+'''');
end;
 
end.
Hide full unit code
   myString = 'Hello Hello Hello '
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page