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

Base X To Long Function
Math Miscellaneous Class

Public Function BaseXToLong( _
      ByVal vString As String _
    , ByVal vBase As Byte _
    ) As Long

Convert a number whose base is assumed to be vBase into a Long (integer) value.

Examples:
    BaseXToLong("10101011101", 2) = 1373
    BaseXToLong("23", 8) = 19
    BaseXToLong("23", 16) = 35
    BaseXToLong("12345678", 16) = 305419896
    BaseXToLong("12345678", 36) = -1 ' #5
    BaseXToLong("12345", 8) = 5349
    BaseXToLong("FFFF", 16) = 65535
    BaseXToLong("377", 8) = 255
    BaseXToLong("-3456", 8) = 1838 ' #9
    BaseXToLong("ABC", 36) = 13368
    BaseXToLong("AZ", 36) = 395
See also:
    BaseXToNumber Function
    NumberToBaseX Function
Summary: This function can convert any numeric string whose base is between 2 and 36. Use base 2 for binary numbers, base 8 for octal numbers, base 10 for decimal numbers, base 16 for hexadecimal numbers, and base 36 for alphanumeric numbers.

vString: String containing the number in base vBase which will be converted to base 10 and returned as a Long value. Function returns -1 if the base-10 equivalent of the number is greater than MaxLong (2,147,483,647) as in example #5.
Note: Function ignores characters which are outside the range of those required to represent numbers within the specified base. For example, if the base if 2, this function will ignore all characters but "0" and "1".

vBase: The number base from which vString will be converted to base 10.
Note: Function has restrictive argument types to avoid argument fix-up overhead. Since function has restrictive argument types and return value it does not support triple-valued logic. Use the BaseXToNumber function for triple-valued logic support.

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