HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
5-33
SCAN
The SCAN function returns an integer containing the position of the first
common character in two strings, scanning from left to right. It returns
the position of the character in the first string specified. An optional
third string parameter will return that first common character. If the
two strings do not have common characters, SCAN returns 0 and the third
string returns the null string.
Syntax
SCAN(
S1
$,
S2
$[,
S3
$])
Parameters
S1
$ A string expression containing one of the two strings
that will be scanned. The position that SCAN returns is
the position of the common character in this string.
S2
$ A string expression containing the second of the two
strings that will be scanned.
S3
$ An optional parameter that will contain the first
character that is common to
S1
$ and
S2
$. SCAN assigns a
value to
S3
$.
Examples
10 A = SCAN("abc","xbzz",A$) !A = 2 and A$ = "b"
20 B = SCAN("abc","djq",B$) !B = 0 and B$ = "", the null string
30 C = SCAN("abc","cba",C$) !C = 1 and C$ = "a"
SDECIMAL
The SDECIMAL function converts a number to short decimal. The result of
this function is of type SHORT DECIMAL.
Syntax
SDECIMAL(
n
)
Parameters
n
The number to be converted. This is of any numeric
type.
Examples
10 A = SDECIMAL(5.678) !A = 5.678
SGN
The SGN function evaluates the sign of a number. It returns the
following value:
-1 if
n
is negative.
0 if
n
is zero.
1 if
n
is positive.
Syntax
SGN(
n
)
Parameters
n
The number that is to be evaluated. This can be of any
numeric type.