HP Pascal/iX Reference Manual (31502-90022)

9- 22
pac : pac20;
s : shortint;
c,m : char;
b : boolean;
begin
pac := 'thisoisoaotest56789 ';
c := '6';
m := ' ';
b := scanuntil( pac, c, m, s );
writeln (s); {16}
writeln (b); {false}
b := scanuntil( pac, 'x', m, s );
writeln (s); {20}
writeln (b); {true}
b := scanuntil( pac, #101, ' ', s );
writeln (s); {12}
writeln (b); {false}
end.
scanwhile
Usage
scanwhile
(s, t1, t2, p)
Parameters
s
A PAC or string variable that contains the source string to be
scanned.
t1
An expression whose value is of any char type.
t2
An expression whose value is of any char type.
p
A shortint variable into which an index is returned which
indicates at which position in the source array the
t2
was
found or the
t1
was not found.
Result
A boolean value:
true : indicates
t2
was found.
false : indicates
t1
was not found.
Description
The function scanwhile scans the source byte string until a byte is found
that does not match the
t1
. The position where the match failed is
returned. The result is a boolean value indicating whether
t2
was found
or
t1
was not found.
NOTE This feature requires the compiler option STANDARD_LEVEL
'EXT_MODCAL'.
Example
$STANDARD_LEVEL 'EXT_MODCAL'$
program asmb005(output);