System.SysUtils.TStringHelper.Create

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

class function Create(C: Char; Count: Integer): string; overload; inline; static;
class function Create(const Value: array of Char; StartIndex: Integer; Length: Integer): string; overload; static;
class function Create(const Value: array of Char): string; overload; static;

Properties

Type Visibility Source Unit Parent
function public System.SysUtils.pas System.SysUtils TStringHelper

Description

Creates a string with a specified number of repeating characters.

Create has three overloaded functions:

The first one creates a string that contains Count times the given C character.

For example, the following code sets S to the string 'AAAAAAAAAA'.

var
  S: string;

begin
  S := String.Create('A', 10);
end;

The second overloaded Create class function returns a newly allocated string of the given length.

If the Length parameter is greater than 0, Create copies the Length characters in Value, starting from StartIndex. Note StartIndex is zero-based.

Finally, the third overloaded Create function returns a newly allocated string containing a sequence of all the characters inside Value.

Note: If there is not enough memory available to create the string, an EOutOfMemory exception is raised.

See Also