ip2long(ip)
Last updated January 09, 2009
Version: 0 | Requires: CF5 | Library: NetLib
Description:
Converts a string containing an (IPv4) Internet Protocol dotted address (aaa.bbb.ccc.ddd) into a proper address representation. Returns 0 if error occurs.
Return Values:
Returns a number.
Example:
<cfoutput>
#ip2long('202.186.13.4')#= 3401190660<br>
</cfoutput>
Parameters:
Name | Description | Required |
---|---|---|
ip | IP address as string. | Yes |
Full UDF Source:
/**
* Converts a string containing an (IPv4) Internet Protocol dotted address (aaa.bbb.ccc.ddd) into a proper address representation.
*
* @param ip IP address as string. (Required)
* @return Returns a number.
* @author Troy Pullis (tpullis@yahoo.com)
* @version 0, January 9, 2009
*/
function ip2long(ip) {
var iparr = ListToArray(ip,".");
if (ArrayLen(iparr) != 4)
return 0;
else
return iparr[1]*256^3 + iparr[2]*256^2 + iparr[3]*256 + iparr[4];
}
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