Here is a sketch for a `SetLength' reference section.
@samp{SetLength} is a Borland Delphi 1.0 extension.
--
Peter Gerwinski, Essen, Germany,
http://home.pages.de/~Peter.Gerwinski/
Maintainer GNU Pascal -
http://home.pages.de/~GNU-Pascal/ - gpc-980511
PGP key on request - 6C 94 45 BE 28 A4 96 - 0E CC E9 12 47 25 82 75
Fight the SPAM and UBE! -
http://spam.abuse.net/ -
http://maps.vix.com/
@c ----------------------------------------------------------------------------
@node SetLength
@unnumberedsec SetLength
@cindex SetLength
@unnumberedsubsec Syntax
@smallexample
Procedure SetLength ( Var S: String; NewLength: Integer );
@end smallexample
@unnumberedsubsec Description
@samp{SetLength} explicitly assigns a new length @samp{NewLength} to the
string parameter @code{S}. The contents of the string is @emph{not} changed;
if the operation increases the length of the string, the characters appended
at the end are @emph{undefined}.
If you want to use @samp{SetLength}, please enable ``extended syntax''
(@samp{--extended-syntax} or @samp{(*$X+*)}).
@unnumberedsubsec Standards
@samp{SetLength} is a Borland Delphi 1.0 extension.
@unnumberedsubsec Example
@example
Program TestSetLength;
(*$X+*) (* Enable "dangerous" features *)
Var
S: String ( 26 );
begin
S:= 'Hello, world!';
SetLength ( S, length ( 'Hello' ) );
writeln ( S ); (* 'Hello' *)
SetLength ( S, 26 );
writeln ( S ); (* 'Hello, world!(%$@§"!"§$§"$' *)
(* undefined characters ^^^^^^^^^^^^^ *)
SetLength ( S, 42 ); (* The overflow is *not* (yet) detected *)
writeln ( S ); (* This might cause a runtime error. *)
end.
@end example
@unnumberedsubsec See also
@ref{@ref{length}, @ref{String}, @ref{SetType}.
@c ----------------------------------------------------------------------------