Substr.UniqueString Method

procedure UniqueString(var Str: Substring); overload; inline;

Gives Str its own copy of its characters, shared with no other string.

#NameTypeDescription
1StrSubstring

Result: stored in self (calling object)

Examples

An adopted string made the string's own.

uses Substr;

procedure Example;
var Text: string;
    s: Substring;
begin
    Text := 'abc';
    s.Adopt(Text);
    UniqueString(s);
    Assert(not s.IsExternal);
end;