Click or drag to resize

BitClear Function (Binary, Long, Long)

X#
Clears the specified bit in a Numeric, Varbinary, or Blob value by setting it to 0 and returns the resulting value. 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 BitClear(
	BinString AS BINARY,
	StartBit AS LONG,
	BitCount AS LONG
) AS BINARY
Request Example View Source

Parameters

BinString
Type: Binary
Specifies a Varbinary or Blob expression.
StartBit
Type: Long
Specifies a starting zero-based number of the first bit to perform the operation as nStartBit and the number of bits to perform the operation as nBitCount.
If you do not specify nStartBit and nBitCount, the operation applies to all bits in the expression. If you specify nStartBit only, the operation applies to nStartBit only.
BitCount
Type: Long
Specifies a starting zero-based number of the first bit to perform the operation as nStartBit and the number of bits to perform the operation as nBitCount.
If you do not specify nStartBit and nBitCount, the operation applies to all bits in the expression. If you specify nStartBit only, the operation applies to nStartBit only.

Return Value

Type: Binary
Numeric, Varbinary, or Blob. BitClear( ) returns the specified expression without specified bit.
Examples
X#
1x = 7  // 0111 binary
2y = 1  // 2nd bit position (0 = 1st bit position)
3? BitClear(x,y) // Returns 5, 0101 binary
See Also