HP Pascal/iX Reference Manual (31502-90022)

9- 8
.
END.
strmove
Usage
strmove
(n, s1, p1, s2, p2)
Parameters
n
An integer expression indicating the number of characters to
be copied.
s1
A string expression or PAC variable.
p1
An integer expression indicating the index in
s1
from which
copying starts.
s2
A string or PAC variable.
p2
An integer expression indicating the index in
s2
where copying
starts.
Description
The procedure strmove
(n, s1, p1, s2, p2)
copies
n
characters from
s1
,
starting at
s1[p1]
, to
s2
, starting at
s2[p2]
. The string length of
s2
is increased, if needed, to (
p2+n
-1) if (
p2+n
-1) > strlen
(s2)
. If
p2
equals strlen
(s2)
+1, strmove is equivalent to appending a subset of
s1
to
s2
. It is an error if
p2
> strlen
(s2)
+1. The value (
p1+n
-1) must not
exceed strlen(
s1
).
The strmove procedure may be used to convert PAC's to strings and vice
versa. It is also a way of manipulating subsets of PAC's.
NOTE The strmove procedure should not be used to move data into an
uninitialized variable, regardless of type.
NOTE The strmove procedure is not appropriate for propagating characters
within a string. Use the strrpt function or the fast_fill
procedure instead.
Example
VAR
pac: PACKED ARRAY[1..15] OF char;
s: string[80];
BEGIN
s:= '';
pac:= 'Hewlett-Packard';
strmove(15,pac,1,s,1); { Converts a PAC to a string. }
END.