'' the original string arranged in groups of the given width. Group returns a string with the chars in ' '' Given an integer value, FormatBinary returns a string of the given width of the ' Note that Group will work on any string, not just binary strings.
The two functions are given here along with a short piece of test code. For example, Group(str,4) will return the string in groups of four characters separated by a space. Since long binary strings are difficult to interpret, let's also provide a grouping function that will return the binary string in user specified groups. By finding the index (one relative) of the hex digit in the string 0123456789ABCDEF and subtracting one, we get a zero relative number which we can then use as an index into an array that maps each hex digit to its four digit binary equivalent. If we first convert the number to e hexadecimal string we can then convert each hex digit into its equivalent four digit binary string. Fortunately the process is straightforward. There are also functions that will format numbers as string (FormatNumber, FormatPercent, FormatCurrentcy, Hex, etc.) One glaring omission is a function to format numbers (integers) as binary. These functions are named C as in CInt (convert to int), CDbl (convert to double), etc.
VbScript has a number of functions for converting from one type to another. Please see my post vbScript - The Basics for more details on vbScript. VbScript - Convert Integer to Binary String