<-- Previous || Up || Next -->

Binary String Fm Variant Function
Bitwise Class

Public Function BinaryStringFmVariant( _
      ByVal vValue As Variant _
    , Optional ByVal vToLSBFirst As Variant _
    ) As Variant

"Binary String From Variant" or "Variant To Binary String"
Create a String in which each character represents one of the bits of the String or numeric value vValue.
Turns a string such as Chr$(3) + Chr$(12) into something like "0000110000000011"
Order of outgoing BITS determined by vToLSBFirst.
The inverse of this function is BinaryStringToVariant.

Example:
    Assuming
       Dim intValue As Integer
       Dim strValue As String
       intValue = 23
       strValue = Chr$(3) + Chr$(12)
    for example
       BinaryStringFmVariant(strValue, False) = "0000001100001100"
       BinaryStringFmVariant(strValue, True)  = "0011000011000000"
       BinaryStringFmVariant(strValue, False) = BinaryStringFmString(strValue, False, False)
       BinaryStringFmVariant(strValue, True)  = BinaryStringFmString(strValue, False, True)
       BinaryStringFmVariant(intValue, False) = BinaryStringFmString(intValue, True, False)
       BinaryStringFmVariant(intValue, True)  = BinaryStringFmString(intValue, True, True)
See also:
    BinaryStringToVariant Function
    BinaryStringFmString Function
vValue: Value whose bits are to each be represented by one character within the result string. Function returns Null if vValue is Null or cannot be coerced to a String.

If vValue is a String, it is assumed that the first character represents the most-significant-byte.

If vValue is numeric, it is assumed that the (once the value has been coerced to a String) the first character represents the least-significant-byte.

vToLSBFirst: True if the result string should represent the bits with the least-significant-bit first, and False if it should represent the bits with the most-significant-bit first. vToLSBFirst defaults to False if it is missing or Null or cannot be fixed up to a number.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.