Function Bitwise Class

BinaryStringToVariant

"Binary String To Variant" or "Variant From Binary String" Converts a binary string such as "0000001100001100" back into the type of value specified by vVarType. Order of incoming BITS determined by vFromLSBFirst argument. The inverse of this function is BinaryStringFmVariant .

Signature (Visual Basic / VBA)

Public Function BinaryStringToVariant( _
      ByVal vValue As Variant _
    , ByVal vVarType As Variant _
    , Optional ByVal vFmLSBFirst As Variant _
    ) As Variant

Code Example

    BinaryStringToVariant("0000001100001100", vbString,  False) = Chr$(3) + Chr$(12)
    BinaryStringToVariant("0000001100001100", vbInteger, False) = 780
    BinaryStringToVariant("0000001100001100", vbString,  True)  = Chr$(48) + Chr$(192)
    BinaryStringToVariant("0000001100001100", vbInteger, True)  = 12480

Parameters

Parameter Description
vValue The string in which each character represents one of the bits within the result value. Function returns Null if vValue is Null or cannot be fixed up to a String.
vVarType The type of value whose bits are represented by the characters in string vValue and the type of value that should be returned by this function after the bits are assembled. Function returns Null if vVarType is Null or cannot be fixed up to a number.
vFmLSBFirst True if the bits in string vValue are organized with the least-significant-bit first, and False if they are organized with the most-significant-bit first. vFmLSBFirst defaults to False if it is missing or Null or cannot be fixed up to a number.