procedure MakeUnique;
Gives the string its own copy of its characters, shared with no other string.
Result: stored in self (calling object)
Remarks:
Characters shared with another string, or adopted from one, are copied; a string that owns its characters alone keeps them. Afterwards Append and ToPChar work in place.
Examples
An adopted string made the string's own.
uses Substr;
procedure Example;
var Text: string;
s: Substring;
begin
Text := 'abc';
s.Adopt(Text);
s.MakeUnique;
Assert(not s.IsExternal);
s.Append('d');
Assert(s = 'abcd');
end;