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);
}

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