Function Coerce Make Class

CoerceToByteFast

"Coerce String To Byte (Fast)" Return the Byte value whose in-memory representation is the same as the first character in string vString. Faster version of the CoerceToByte function which has restrictive argument types (to avoid argument fix-up overhead).

Signature (Visual Basic / VBA)

Public Function CoerceToByteFast( _
    ByVal vString As String _
    ) As Byte

Code Example

    CoerceToByteFast(Chr$(0)) = 0
    CoerceToByteFast(Chr$(1)) = 1
    CoerceToByteFast(Chr$(255)) = 255

Parameters

Parameter Description
vString The string whose first character is to be interpreted as a Byte value.

Notes & Version History

Note Function does NOT generate an error if vString empty or more than one character long.
Note If vString if more than one character long, the only the first character is used.