Function String Numerics Class

StringToHexadecimalPairs

Converts each of the characters in a string into another string where each pair of characters if the ASCII value of the character in hexadecimal form.

Signature (Visual Basic / VBA)

Public Function StringToHexadecimalPairs( _
    ByVal vString As Variant _
    ) As Variant

Code Example

    StringToHexadecimalPairs("AB") = "4142"
    StringToHexadecimalPairs(Chr$(1) + Chr$(19)) = "0113"

Parameters

Parameter Description
vString String whose characters are to be each represented by two hexadecimal digits in the result string. Function returns Null if vString is Null or cannot be fixed up to a String.

Notes & Version History

Details This is inverse of the HexadecimalPairsToString function.
Note This function is useful for encoding strings containing non-printable characters into printable strings. The strings encoded with this function are decoded with the HexadecimalPairsToString function.