Substring.Append Method

Overload List

#SignatureDescription
1procedure Append(const C: Char); overload;
2procedure Append(const P: PChar; const Count: Integer); overload;
3procedure Append(const S: Substring); overload;Appends S after the text, in place.
4procedure Append(const S: string); overload;

Overload 1: procedure Append(const C: Char); overload;

#NameTypeDescription
1CChar

Result: stored in self (calling object)

Overload 2: procedure Append(const P: PChar; const Count: Integer); overload;

#NameTypeDescription
1PPChar
2CountInteger

Result: stored in self (calling object)

Overload 3: procedure Append(const S: Substring); overload;

Appends S after the text, in place.

#NameDescription
1S

The text appended: a Substring, a string, a Char, or Count characters at a PChar.

Result: stored in self (calling object)

Remarks:

The characters must be the string's own, shared with no other string, else ESubstringInPlaceError is raised; MakeUnique gives the string its own copy first. Within the room the string has or its Capacity - no memory is taken. Past it the string grows, or, while SubstringAllocCheck is True, ESubstringAllocError is raised.

Examples

Appending every kind.

uses Substr;

procedure Example;
var s: Substring;
begin
    s := Substring('ab');
    s.Append('cd');
    s.Append(Char('!'));
    s.Append(PChar('xyz'), 2);
    Assert(s = 'abcd!xy');
end;
See Also: Substring.AppendInt, Substring.Capacity

Overload 4: procedure Append(const S: string); overload;

#NameTypeDescription
1Sstring

Result: stored in self (calling object)