BitTest Function (Binary, Long) | |
Determines whether a specific bit in a Numeric, Varbinary, or Blob value is set to 1.
There is a numeric and a binary version of the syntax.
If the specified expression is not an integer, it is converted to an integer before performing the operation.
Namespace:
XSharp.VFP
Assembly:
XSharp.VFP (in XSharp.VFP.dll) Version: 2.21
Syntax FUNCTION BitTest(
BinString AS BINARY,
BitNumber AS LONG
) AS LOGIC
public static bool BitTest(
Binary BinString,
int BitNumber
)
Request Example
View SourceParameters
- BinString
- Type: Binary
Specifies a Varbinary or Blob expression to check for the specified bit.
- BitNumber
- Type: Long
Specifies a zero-based bit in BinString.
If nBitNumber is out of range of BinString, X# generates an error.
Return Value
Type:
Logic
Logical.
BitTest( ) returns True (.T.) if the specified bit is set to 1; otherwise, it returns False (.F.).
Examples 1Clear
2? '2 even? '
3?? IsEven(2)
4? '3 even? '
5?? IsEven(3)
6? '0 even? '
7?? IsEven(0)
8? '-13 even? '
9?? IsEven(-13)
10Function IsEven
11PARAMETER nInteger
12RETURN NOT BitTest(nInteger, 0)
See Also