HP 3000 Manuals

SCAN [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Reference Manual

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"



MPE/iX 5.0 Documentation