mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 01:48:00 +02:00

+ implement low/high for dynamic strings, resolves #15244 and #22936 + basic support for $zerobasedstrings directive git-svn-id: trunk@22933 -
32 lines
335 B
ObjectPascal
32 lines
335 B
ObjectPascal
program Project1;
|
|
|
|
var
|
|
s: ansistring;
|
|
i : integer;
|
|
|
|
begin
|
|
s := 'abc';
|
|
|
|
i:=1;
|
|
|
|
if low(s)<>i then
|
|
halt(1);
|
|
|
|
if high(s)<>3 then
|
|
halt(1);
|
|
|
|
i:=0;
|
|
|
|
{$ZEROBASEDSTRINGS ON}
|
|
if low(s)<>i then
|
|
halt(1);
|
|
|
|
if high(s)<>2 then
|
|
halt(1);
|
|
|
|
if s[0]<>'a' then
|
|
halt(1);
|
|
{$ZEROBASEDSTRINGS OFF}
|
|
writeln('ok');
|
|
end.
|