CFLib.org – Common Function Library Project

HexToDec(str)

Last updated November 06, 2001

author

Rob Brooks-Bilson

Version: 1 | Requires: CF5 | Library: MathLib

Description:
Converts from hexadecimal (base16) to decimal (base10). Provides a wrapper around the BIF InputBaseN. Converts both positive and negative numbers.

Return Values:
Returns a number.

Example:

<CFSET x='3E8'>
<CFSET y='FFFFFC18'>
<CFOUTPUT>
#x# represented in decimal is: #HexToDec(x)#<BR>
#y# represented in decimal is: #HexToDec(y)#<BR>
</CFOUTPUT>

Parameters:

Name Description Required
str String representing hexadecimal value you want converted to decimal. Yes

Full UDF Source:

/**
 * Converts from hexadecimal (base16) to decimal (base10).
 * 
 * @param str      String representing hexadecimal value you want converted to decimal. 
 * @return Returns a number. 
 * @author Rob Brooks-Bilson (rbils@amkor.com) 
 * @version 1.0, November 6, 2001 
 */
function HexToDec(str){
  return InputBaseN(str, 16);
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson