Free Game Downloads -- Sodaware.net

Free Game Downloads -- Role Playing Games, Puzzle Games and Action Games.

Blitz_Basic_HexToInt.bb

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

; ----------------------------------------------------------------------
; -- Blitz_Basic_HexToInt.bb
; --
; -- Converts a hexadecimal string value into an integer.
; --
; -- Version : 1.0
; -- Licence : Public Domain
; ----------------------------------------------------------------------

;;; <summary>Converts a hex value to an integer value.</summary>
;;; <param name="hexValue">The hex value to convert.</param>

;;; <returns>Integer value.</returns>
;;; <subsystem>Blitz.Basic</subsystem>
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

Free Game Downloads | Site Map | Links | Anonymous Feedback | Contact Us

© 2005-2007 Sodaware. All rights reserved. About Us | Privacy Policy