HP Pascal/iX Reference Manual (31502-90022)

9- 6
e
An integer expression. The value of
e
must not be greater
than the maximum length of
s
.
Description
The procedure setstrlen
(s, e)
sets the current length of
s
to
e
without
modifying the contents of
s
.
If the new length of
s
is greater than the previous length of
s
, the
extra components become defined, but no value is given to them. No blank
filling occurs. If the new length of
s
is less than the previous length
of
s
, previously defined components beyond the new length become
undefined.
Example
VAR
alpha: string[80];
BEGIN
.
alpha:= 'abcdef'; { strlen(alpha) = 6 }
.
setstrlen(alpha,2*strlen(alpha)); { Doubles current length }
. { of alpha. Alpha[7] }
. { through alpha[12] have }
. { unpredictable values. }
.
setstrlen(alpha,2) { Alpha[3] through }
. { alpha[80] not undefined.}
END.
strappend
Usage
strappend
(s1, s2)
Parameters
s1
A string variable.
s2
A string expression whose length must be less than the
difference between the maximum and actual length of the string
variable
s1
.
Description
The procedure strappend
(s1, s2)
appends string
s2
to
s1
. It is an error
if the strlen of
s2
is greater than strmax
(s1)
-strlen
(s1)
. That is, it
cannot exceed the number of characters left to fill in
s1
. The current
length of
s1
is updated to strlen
(s1)
+strlen
(s2)
.
Example
VAR
message: string[132];
BEGIN
.
message:= 'Now hear ';
strappend(message,'this!'); { message is 'Now hear this!' }
.
END.