Click or drag to resize

InListExact Function

X#
Indicate whether the first expression in a series is repeated later in the series.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION InListExact(
	uValue AS USUAL,
	uValueList PARAMS USUAL[]
) AS LOGIC
Request Example View Source

Parameters

uValue
Type: Usual
The value that is looked up in the list. This can be any data type.
uValueList
Type: Usual
A list of expressions separated by commas.
These expressions should be the same data type as the expression in uValue
If one or more of these expressions are not the same type as the first expression, a runtime error may happening indicating a data type mismatch.

Return Value

Type: Logic
TRUE if the first expression matches any of the other listed expressions; otherwise, FALSE.
Remarks
InListExact() determines whether an expression is found in a series of expressions. The first expression is compared to each of the other expressions until either a match is found or the entire list has been traversed. InListExact() is the same as InList() except that == is used for matching instead of =. There is no difference between InList() and InListExact() for non string datatypes.
Examples
This examples use InList() to indicate whether the first expression in each series is repeated later in the series:
X#
1? InList("b", "a", "b", "c")        // TRUE
2? InList("d", "a", "b", "c")        // FALSE
3nJack  := 11
4nQueen := 12
5nKing  := 13
6nAce   := 14
7? InList(nJack, nQueen, nKing, nAce)     // FALSE
8? InList(nJack, nAce, nJack, nQueen, nKing)     // TRUE
Examples
This example compares InList() and InListExact() when the left operand in a comparison is longer than the right operand of a comparison:
X#
1? InList("longer", "long")        // TRUE
2? InList("long  ", "long")        // TRUE
3? InListExact("longer", "long")    // FALSE
4? InListExact("long  ", "long")    // FALSE
This example compares InList() and InListExact() when the right operand in a comparison is longer than the left operand of a comparison:
X#
1? InList("long", "longer")        // FALSE
2? InList("long", "long  ")        // FALSE
3? InListExact("long", "longer")    // FALSE
4? InListExact("long", "long  ")    // FALSE
See Also