Previous: karupk Up: ../karrtn.html Next: karxlt
INTEGER FUNCTION KARVFY (TEXT,LOCTXT,LENTXT, # PATERN,LOCPAT,LENPAT) Search the string defined by TEXT,LOCTXT,LENTXT for the first character which is NOT contained in the pattern string defined by PATERN,LOCPAT,LENPAT. If any of LOCTXT, LENTXT, LOCPAT, or LENPAT is less than 1, return 0. If all characters in the first string are found in PATERN(*), return 0. Otherwise return the index of the first mismatching character in TEXT(*), counting from the first character stored in TEXT(*). Thus KARVFY always returns a value 0, or one which is not less than LOCTXT. It is important to note that the index returned points to the first string, not to the pattern string. KARVFY is based upon the PL/1 VERIFY function. In PASCAL, its would be implemented by testing a character to see if it belongs to the set of characters forming the pattern. For example, if the pattern contained letters, digits, and a space, then KARVFY would return the index of the first character in TEXT(*) which was not a letter, digit, or space. This is a rather convenient function to have for implementing command parsers.