LOOKUP function
Returns an INTEGER value giving the position of an expression in a list. Returns a 0 if the expression is not in the list.
Syntax
expression
list
character
ExamplesThis procedure prompts the user for a New England state. The LOOKUP function tests the value against the list of states stored in the stlist variable. If there is no match (the result is 0), the procedure displays a message. Otherwise, the procedure prompts the user for another New England state.
The following example uses a different delimiter, which list all fields that have “
sls
” or “sales
” as words in their standard Dictionary labels:
Notes
- If
expression
contains a delimiter, LOOKUP returns the beginning of a series of entries inlist
. For example, LOOKUP("a,b,c","x,a,b,c") returns a 2.- Most character comparisons are case insensitive in ABL. By default, upper-case and lower-case characters have the same sort value. However, you can define fields and variables as case sensitive (although it is not advised, unless strict ANSI SQL adherence is required). If the
expression
orlist
is defined as case sensitive, the comparison between them is also case sensitive and “Smith” does not equal “smith”.- The LOOKUP function is double-byte enabled. The specified
expression
can yield a string value that contains double-byte characters and thecharacter
delimiter can be a double-byte character.- The LOOKUP function always returns 0 if an expression is equal to a delimiter.
See also
OpenEdge Release 10.2B
|