CFLib.org – Common Function Library Project

nBase36(num)

Last updated June 11, 2009

author

David Edgar

Version: 0 | Requires: CF5 | Library: MathLib

Description:
Creates a base 36 from numbers that don't fit inside an integer.

Return Values:
Returns a string.

Example:

<cfoutput>#nBase36(87123456789)#</cfoutput>

Parameters:

Name Description Required
num Number to convert. Yes

Full UDF Source:

/**
 * Creates a base 36 from numbers that don't fit inside an integer.
 * 
 * @param num 	 Number to convert. (Required)
 * @return Returns a string. 
 * @author David Edgar (appsupport@hotmail.com) 
 * @version 0, June 11, 2009 
 */
function nBase36(num){
	var stream = chr(32);
	var chars = "0123456789abcdefghijklmnopqrstuvwxyz";
	var res = "";
	if (num GT 0) { 
		while (num GT 0) {
			res = num - 36 * int(num / 36);
			num = int(num / 36);
			stream = mid(chars,res + 1,1) & stream;
		}
	} else {
		stream = num;
	}
	return(stream);
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson