Substring.Create Constructor

constructor Create(const Src: string); overload;

A view of Src, as Adopt: the window covers Src's characters, which are not copied.

#NameDescription
1Src

The string viewed; it must live unchanged while the view is used.

Result: stored in self (calling object)

Examples

A view of a string.

uses Substr;

procedure Example;
var Text: string;
    s: Substring;
begin
    Text := 'viewed';
    s := Substring.Create(Text);
    Assert(s.IsExternal);
    Assert(s = 'viewed');
end;
See Also: Substring.Adopt