Click or drag to resize

Between Function

X#
Determine if a value is between two other values.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION Between(
	uValue AS USUAL,
	uMin AS USUAL,
	uMax AS USUAL
) AS LOGIC
Request Example View Source

Parameters

uValue
Type: Usual
A value of any type to compare to uMin and uMax.
uMin
Type: Usual
The minimum value to compare with.
This must be of the same type as uValue except that numerics of different types are allowed.
uMax
Type: Usual
TThe maximum value to compare with. This must be of the same type as uValue except that numerics of different types are allowed.

Return Value

Type: Logic
TRUE if the value is greater than or equal to the minimum and less than or equal to the maximum otherwise, FALSE.
Remarks
Between() can be used to do advanced searching on polymorphic data types.
For example, it can determine whether A character falls between 2 other characters, either in the alphabet or the ASCII chart A date falls between 2 other dates A number falls between 2 other numbers
Tip Tip
String comparisons: String comparisons are nation-dependent. Be aware that a character can fall between 2 other characters in the ANSI character set but not in the OEM character set. Thus, when passing strings you may often need to specify whether the ANSI or the OEM character set should be used. Floating point comparisons: SetFloatDelta() affects the outcome of Between().
Examples
These examples show what would happen if you use Between() to search for the letters "cd" in a list of the alphabet:
X#
1? Between("cd", "ab", "ef")    // TRUE
2? Between("cd", "gh", "kl")    // FALSE
This example determines whether today's date is between 12/12/93 and 12/12/94:
X#
1// Return value depends on today's date
2? Between(Today(), 93.12.12, 94.12.12)
This example does comparisons based on numbers:
X#
1? Between(2, 1, 3)        // TRUE
See Also