HP Pascal/iX Reference Manual (31502-90022)

9- 7
strdelete
Usage
strdelete
(s, p, n)
Parameters
s
A string variable.
p
An integer expression representing the starting index of the
deletion.
n
An integer expression representing the number of characters to
be deleted.
Description
The procedure strdelete
(s, p, n)
deletes
n
characters from
s
starting at
component
s [ p ]
, and the current length of
s
is updated to the length
of
s-n
. It is an error if
n+p-1
is greater than the current length of
s
.
Example
VAR
uncensored, censored: string[80];
BEGIN
.
uncensored:= 'Attack at 6 a.m.!';
strdelete(uncensored,7,strlen(uncensored)-7);
censored:= uncensored; { censored is 'Attack!'. }
.
.
END.
strinsert
Usage
strinsert
(s1, s2, p)
Parameters
s1
A string expression.
s2
A string variable.
p
An integer or an integer expression representing the offset in
s2
where insertion begins.
Description
The procedure strinsert
(s1, s2, p)
inserts string
s1
into
s2
starting at
s2 [ p ]
. Initially,
s2
must be at least
p
-1 characters in length, or it
is an error. The resulting string may not exceed strmax
(s2)
. The
current length of
s2
is updated to strlen
(s1)
+ strlen
(s2)
.
Example
VAR
remark: string[80];
BEGIN
.
remark:= 'There is missing!';
strinsert(' something',remark,9);{ remark is 'There is something missing! }