Visual Basic 6 function "hexdec"

Go back

Below you'll find the source for the Visual Basic 6 function hexdec.

Attribute VB_Name = "modHexdec"
' This function is downloaded from:
' http://www.stefanthoolen.nl/archive/vb6-functions/
' 
' You may freely distribute this file but please leave all comments, including this one, in it.
' 
' @Author Stefan Thoolen <mail@stefanthoolen.nl>

Option Explicit

''
' Converts a heximal string to a decimal integer
' Same syntax as the PHP function 'hexdec'
' See also: http://www.php.net/manual/en/function.hexdec.php
' @param    String  hex_string      The heximal string
' @return   Integer                 An integer value
' @author   Stefan Thoolen <mail@stefanthoolen.nl>
Public Function hexdec(hex_string As String) As Integer
    hexdec = Val("&h" & hex_string)
End Function