Blitz_Basic_HexToInt

Name: Blitz_Basic_HexToInt.bb
Version: 1.0
Released: September 10th, 2006
Description: Converts a hexadecimal string into an integer value.
Download: Download Now (0.89KB)
; ----------------------------------------------------------------------
; -- Blitz_Basic_HexToInt.bb
; -- 
; -- Converts a hexadecimal string value into an integer.
; -- 
; -- Version : 1.0
; -- Licence : Public Domain
; ----------------------------------------------------------------------

;;; Converts a hex value to an integer value.
;;; The hex value to convert.

;;; Integer value.
;;; Blitz.Basic
Function HexToInt(hexValue$)
	
	Local hexDigit%
	Local strPos% 		= 1
	Local strLen% 		= Len(hexValue$)
	Local integerValue% = 0
	
	Repeat
		
		hexDigit = (Asc(Mid$(hexValue$, strPos, 1)) - 48) And $1f
		If hexDigit > 9 Then hexDigit = hexDigit - 7
		integerValue = (integerValue Shl 4) + hexDigit
		
		strPos = strPos + 1
		
	Until strPos > strLen
	
	Return integerValue
	
End Function