Public Function FixUpBitwiseArguments( _ ByRef rFixUpToType As Variant _ , ByRef rOne As Variant _ , ByRef rTwo As Variant _ ) As Boolean
Assuming Dim varRtnType As Variant Dim varOne As Variant Dim varTwo As Variant varOne = 23 varTwo = -23 for example FixUpBitwiseArguments(varRtnType, varOne, varTwo) leaves varRtnType = vbInteger varOne = Chr$(23) + Chr$(0) varTwo = Chr$(233) + Chr$(255)See also:
FixUps ClassrOne: First of the two arguments which is to be fixed up to a String.
If rOne is Null, the function returns False and sets rFixUpToType to Null (so that the function calling function can easily support three-valued logic by returning this value).
If rTwo is Null, the function returns False and sets rFixUpToType to Null. (so that the function calling function can easily support three-valued logic by returning this value).
If both rOne and rTwo are empty, the function returns False and sets rFixUpToType to Empty. (so that the function calling function can easily support three-valued logic by returning this value).
If rOne is empty, rTwo will be coerced to a String, rOne will be changed to a Nil character (Chr$(0)) filled String of the same length, and rFixUpToType will be set to the type of rTwo.
If rTwo is empty, rOne will be coerced to a String, rTwo will be changed to a Nil character (Chr$(0)) filled String of the same length, and rFixUpToType will be set to the type of rOne.
If either rOne or rTwo is a String, rFixUpToType will be set to vbString.
If rOne is a String and rTwo is numeric, rTwo will be coerced to a String, the bytes within that string will be reversed, and whichever argument String is now shorter will be left-padded with zero-value bytes (the strings will be right aligned).
If rOne is numeric and rTwo is a String, rOne will be coerced to a String, the bytes within that string will be reversed, and whichever argument string is now shorter will be left-padded with zero-value bytes (the Strings will be right aligned).
If both rOne and rTwo are numeric, both will be coerced into String values, and rFixUpToType will be set to an appropriately-capable data type, as described in the following table:
Var2 Byt Int Lng Sng Dat Cur Dec Dbl +-------------------------------- Var1 Byt | Byt Int Lng Sng Dat Cur Dec Dbl Int | Int Int Lng Sng Dat Cur Dec Dbl Lng | Lng Lng Lng Sng Dat Cur Dec Dbl Sng | Sng Sng Sng Sng Dat Cur Dec Dbl Dat | Dat Dat Dat Dat Dat Cur Dec Dbl Cur | Cur Cur Cur Cur Cur Cur Dec Dbl Dec | Dec Dec Dec Dec Dec Dec Dec Dbl Dbl | Dbl Dbl Dbl Dbl Dbl Dbl Dbl DblAbbreviations:
Byt = Byte Int = Integer Lng = Long (integer) Sng = Single (precision floating point) Dat = Date Cur = Currency Dec = Decimal Dbl = Double (precision floating point)v1.5 Change: This function has been extended to support the new Decimal data type in VB 6.0.
If the fixed-up Strings have different lengths, whichever argument string is now shorter will be right-padded with zero-value bytes so that it is as long as the other string.
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.