Substring.Create Method

Overload List

#SignatureDescription
1class function Create(const C: Char; const Count: Integer): Substr.Substring; overload; static;A new value: Count times C, the characters of Value, or Length characters of Value from StartIndex.
2class function Create(const Value: array of Char): Substr.Substring; overload; static;
3class function Create(const Value: array of Char; const StartIndex, Length: Integer): Substr.Substring; overload; static;

Overload 1: class function Create(const C: Char; const Count: Integer): Substr.Substring; overload; static;

A new value: Count times C, the characters of Value, or Length characters of Value from StartIndex.

#NameTypeDescription
1CChar
2CountInteger

Returns: Substring - The new value, inline when it fits.

Remarks:

A negative Count, or a range outside Value, raises ESubstringRangeError.

Examples

Repeated and copied characters.

uses Substr;

procedure Example;
begin
    Assert(Substring.Create('-', 3) = '---');
    Assert(Substring.Create(['a', 'b']) = 'ab');
    Assert(Substring.Create(['a', 'b', 'c'], 1, 2) = 'bc');
end;
See Also: Substr.StringOfChar

Overload 2: class function Create(const Value: array of Char): Substr.Substring; overload; static;

#NameTypeDescription
1Valuearray of Char

Returns: Substring

Overload 3: class function Create(const Value: array of Char; const StartIndex, Length: Integer): Substr.Substring; overload; static;

#NameTypeDescription
1Valuearray of Char
2StartIndexInteger
3LengthInteger

Returns: Substring