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

Binary String Fm String Function
Bitwise Class

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

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

Example:
    Assuming
       Dim strValue As String
       strValue = Chr$(3) + Chr$(12)
    for example
       BinaryStringFmString(strValue, False, False) = "0000001100001100" ' #1
       BinaryStringFmString(strValue, True,  False) = "0000110000000011" ' #2
       BinaryStringFmString(strValue, False, True)  = "0011000011000000" ' #3
       BinaryStringFmString(strValue, True,  True)  = "1100000000110000" ' #4
Example #1 converts from most-significant-byte-first to most-significant-bit-first. It is usually used for converting String values, and it is also used for converting numbers from most-significant-byte-first architectures.
Example #2 converts from least-significant-byte-first to most-significant-bit-first. It is usually used for converting numbers.
Example #3 converts from most-significant-byte-first to least-significant-bit-first.
Example #4 converts from least-significant-byte-first to least-significant-bit-first.
See also:
    BinaryStringToString Function
    BinaryStringFmVariant Function
vValue: String whose characters' bits are to each be represented by one character within the result string. Function returns Null if vValue is Null or cannot be fixed up to a String.

vFmLSBFirst: True if the bytes in String vValue are organized with the least-significant-byte first, and False if the bytes in String vValue are organized with the most-significant-byte first. vFmLSBFirst defaults to False if it is Null or cannot be fixed up to a number.

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.