OpenString (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following example uses the OpenString type:

Code

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

procedure Foo(var S: Openstring);
begin
  Writeln(Length(S)); { 5 }
  Writeln( High(S)); { 10 }
  Writeln(SizeOf(S)); { 11 }
  Writeln(Integer(S[0])); { 5 }
  Writeln(S[1]); { C }
  S[1] := 'T';
end;

var
  S: String[10];

begin
  S := 'Corfu';
  Foo(S);
  Writeln(S[1]); { T }
  Readln;

end.

Uses