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

Coerce To Long Fast Function
Coerce Make Class

Public Function CoerceToLongFast( _
    ByVal vString As String _
    ) As Long

"Coerce String To Long (Fast)"
Return the Long value whose in-memory representation is the same as the first 4 (four) characters in string vString.
Similar to the CVL function in earlier versions of Microsoft Basic.
Faster version of the CoerceToLong function which has restrictive argument types (to avoid argument fix-up overhead).

Examples:
    CoerceToLongFast(String$(4, 0)) = 0&
    CoerceToLongFast(Chr$(1) + Chr$(0) + Chr$(0) + Chr$(0)) = 1&
    CoerceToLongFast(Chr$(0) + Chr$(1) + Chr$(0) + Chr$(0)) = 256&
    CoerceToLongFast(String$(4, 255)) = -1&
    CoerceToLongFast(String$(4, 254)) = -16843010&
See also:
    CoerceToLong Function
    MakeLongFast Function
vString: The string whose first four characters are to be interpreted as a Long value.
Note: Function does NOT generate an error if vString less than or greater than four characters long.
Note: If vString is more than four characters long, the leftmost four characters are coerced to a Long value.

Note: This function first converts the string from Unicode to the default code page of the system.
v1.3 Change: Removed 16-bit support from this function.

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