Previous Topic: IROUTE()

Next Topic: LOADIMOD()

KEYVAL()

Use the KEYVAL() function to scan an input string for a key.

Syntax

The KEYVAL() function has this syntax:

result = KEYVAL(string,key,[default])

Arguments

The KEYVAL() function takes these arguments:

result

Contains one of the following:

  • If an error occurs, error text is returned.
  • If key is found, the next blank-delimited word is returned.
  • Otherwise, the value for default is returned.

string

Text string to be scanned.

key

Keyword value to scan for in the input string.

If matched, the value returned is the first non-blank character after key, and all subsequent characters until the next blank.

default

Value to be returned if key is not found. The default is null string.

Return Codes

The KEYVAL() function produces these return codes:

101 - 103

ARG n MISSING OR INVALID

Example

keyval('a hush was heard','hu','NOT FOUND')   == 'was'
                                                  /* Next word */
keyval('a hush was heard',' hu ','NOT FOUND') == 'NOT FOUND'