CFLib.org – Common Function Library Project

UtilityLib

Last updated December 27, 2013 / 187 Released UDF(s)
IsBIF

Returns true if the function is a BIF (built in function). | Requires: CF5

IsFunction

Returns true if the function is a BIF (built in function) or UDF (user defined function). | Requires: CF5

FullQualUrl

Replace relative url's with a fully qualified URL | Requires: CF5

HSLtoHex

Convert an HSL (hue, saturation, luminance) triplet to a hex RGB triplet. | Requires: CF5

HexToHSL

Convert a hex RGB triplet to HSL (hue, saturation, luminance). | Requires: CF5

HexToRGB

Convert a hexadecimal color into a RGB color value. | Requires: CF5

IsWebSafeColor

Returns true if the given color is a web safe hexadecimal color. | Requires: CF5

CFParam

Function to duplicate the tag within CFSCRIPT. | Requires: CF5

DeleteClientVariables

This function deletes all client variables for a user. | Requires: CF5

Grayscale

Converts an HTML (hex) color code to gray. An optional second argument allows for conversion to a web-safe color in the same step. | Requires: CF5

RGBtoHex

Converts an RGB color value into a hexadecimal color value. | Requires: CF5

EvenOddColor

Returns different colors if the number passed to it is even or odd. | Requires: CF5

GetAlphabetPosition

Returns the numeric value of a letter's position in the alphabet, or the returns matching letter of a number in the alphabet. | Requires: CF5

IsCustomTag

Returns true/false if the current template is being called as a custom tag. | Requires: CF5

DogYearsToHumanYears

This UDF translates a dogs age to a humans age. | Requires: CF5

IsIncluded

Checks to see if calling template is base template. | Requires: CF5

StructToHidden

Converts a structure to hidden form fields. | Requires: CF5

URLToHidden

Converts the URL structure to hidden form fields. | Requires: CF5

FormToHidden

Converts the Form structure to hidden form fields. | Requires: CF5

ClientLocale

Attempts to deduce the visitor's locale. | Requires: CF5

IsSessionVarEnabled

Returns true if session variables are enabled. | Requires: CF6

IsApplicationVarEnabled

Returns true if application variables are enabled. | Requires: CF6

IsDatasource

Returns a boolean if the datasource name exists. | Requires: CF6

MakeSelectList

Creates a Select form item populated with given string items. | Requires: CF5

IsHomeCircuit

a template calling itself is at home, otherwise, its not at home. | Requires: CF5

RedirectTo

Works like cflocation. | Requires: CF5

ToggleValue

Toggles a value (ie: "stop"/"start") between two options. | Requires: CF5

IsClientTimeout

Returns True if the user has not requested a page within the given time span. | Requires: CF5

OptArg

Pass in an optional UDF argument and define a default value at once. | Requires: CF5

OptArgType

Pass in an optional UDF argument of a specific type and define a default value at once. | Requires: CF5

GetRootPath

Determines the root path of the application without hard-coding. | Requires: CF5

NextN

Enables next 'n' browsing of a record set. | Requires: CF5

GetLoadTime

Measures the elapsed time (load time) from when the single function was first called to the time it was last called. | Requires: CF5

CountDown

Counts down to a date. | Requires: CF5

IsScheduledTask

Returns true if the specified task name exists as a scheduled task in the CF Administrator. | Requires: CF6

DownLoadTime56k

Returns estimated download time for a 56k modem given the file size. | Requires: CF5

CssPtScale

CssPtScale increases the point size of text by one point for browsers other than Microsoft Internet Explorer. | Requires: CF5

NonZero

NonZero returns TRUE if a value (numeric or text) is not an empty string and is greater than 0. | Requires: CF5

GetClientVariables

Function returns a structure of client variable. | Requires: CF5

GetBaseCustomTagList

Returns a list of ancestor custom tags. | Requires: CF5

GetEnv

Returns environment information. (Windows only!) | Requires: CF6

DebugVars

Outputs a load of variables for debugging purposes. | Requires: CF6

getFunctionCode

This will return the CFML code for a given user-defined function. | Requires: CF6

ReturnWebRootTranslated

Returns the translated (file system) location of the web root directory. | Requires: CF5

jsLocation

A javascript alternative to the cflocation tag. | Requires: CF5

customTagContext

Return the calling template for a custom tag. | Requires: CF6

RandomColor

Returns a completely random color. Beautiful, isn't it? | Requires: CF5

DeleteCFCache

Force recompiling of a page in the cfclasses cached folder. | Requires: CF6

fadeList

Creates a comma separated list of hex colors forming a gradient between the start color and the end color over a specified number of steps. | Requires: CF5

RandomColorClose

Returns a random color close to your given color. | Requires: CF5

deleteFormFields

Removes specified fields from a form structure. | Requires: CF5

versionThis

Increments the values of a 3 place version number. | Requires: CF5

IsViaSoap

Returns true if the curent request is SOAP based. | Requires: CF6

Sleep

Causes the current request to wait for a specified amount of time. | Requires: CF6

randomColorShade

Returns a random color of a specified shade, light, dark, extra light, extra dark, or any. | Requires: CF5

forward

Performs a serverside redirection. | Requires: CF6

TranslateRSSItems

Translates a RSS Feed's items to a query. | Requires: CF5

reverseColor

Returns the opposite of a color. | Requires: CF5

GetDSN

Gets the configuration of an existing datasource. | Requires: CF6

GetServerIP

Gets the ip address of the server. | Requires: CF5

enableDisableWhiteSpaceManagement

This function will enable or disable whitespace management in ColdFusion Server without access to ColdFusion Administrator. | Requires: CF6

addRemoveDebuggingIPAddress

This function will either add or remove an IP address to the list of debugging ip addresses if you do not have an administrator access. | Requires: CF6

getMapDirectory

Gets the directory path for CF mapping logical path. | Requires: CF6

SiNo

The same as YesNoFormat() function, but in Italian. | Requires: CF5

getMimeType

Returns mime type and subtype for a file. | Requires: CF5

getJavaMetadata

Introspect Java object's fields, methods, and all inheritance info. | Requires: CF6

trueFalseToInt

Simple function to format a true / false value to an integer (true=1, false=0). | Requires: CF5

getVariableScope

Function that determines which scope an unscoped variable refers to. | Requires: CF5

SessionClear

Allows you to 'structclear' an entire session without worrying about deleting ColdFusion's built in variables. | Requires: CF5

enableDisableDebugging

This UDF will enable or disable debugging service with Admin access | Requires: CF6

forceWholeQuantityRange

Force a value to whole quantity and restrict to a given min/max range. | Requires: CF5

createJavaObject

Allows one to use virtual paths to Java objects. | Requires: CF6

calculateBMI

Calculates the Body Mass Index. | Requires: CF6

setThreadPriority

Allows you to set the scheduling priority of the current thread. | Requires: CF6

getScheduleTasks

This function will return a query listing all the schedule task on a ColdFusion server without admin access. | Requires: CF6

deleteDoctype

Deletes the doctype out of the current page request. | Requires: CF6

CID

Returns a globally unique Content ID value. | Requires: CF6

KByte

Converts a byte value into kb or mb if over 1,204 bytes. | Requires: CF6

prefetchLink

Creates the prefetch directive for Mozilla/Firefox browsers. | Requires: CF5

cfcToPrinter

Given the fully-qualified path of a CFC, it renders the cfcexplorer.getcfcashtml() output to html, flahspaper, or PDF for printing as reference. | Requires: CF7

requestINOut

Normalize input structures (URL, FORM, FLASH) to a single Request.IN structure for ubiquitous name space programming. | Requires: CF5

isImage

Checks to see if an image URL contains a valid jpeg or gif. | Requires: CF6

parseRawForm

Parses Form data structure out of HTTP header; this leaves empty entries in, unlike CFMX. | Requires: CF6

getApplicationName

returns the name of the cfapplication. | Requires: CF6

SuperSpacer

A UDF that will add a spacer gif image in a varity of formats to assist in page layout. | Requires: CF5

getProfile

Gets all initialization file entries. | Requires: CF5

decBitwiseToQuery

You provide me with a decimal number, and a string for a column name and I will return to you a query containing of the decimal values for each resulting non-zero value when your number is converted to binary. | Requires: CF5

decToBinValList

Converts decimal number to list of binary place values. | Requires: CF5

getCardType

Returns the card type of a card number. | Requires: CF5

getNISTTime

Obtains current time data from NIST Internet Time Service servers. | Requires: CF6

viewCSS

Returns a visual representation of stylesheet elements. | Requires: CF5

filterFilename

This function will remove any reserved characters from a filename string and replace any spaces with underscores. | Requires: CF6

UTMLetterDesignator

Determines the correct UTM letter designator for a given latitude. | Requires: CF5

calculateUTMZone

Calculates correct UTM zone for a given latitude/longitude point. | Requires: CF5

param

Function to duplicate the cfparam for scoped variables. | Requires: CF5

imageResizeAspectRatio

Returns the proper dimensions of an image resized to a certain maximum size. | Requires: CF5

collectionExists

Call this function, passing in a collection name, to see if that named Verity colleciton exists. | Requires: CF6

nullFormat

A convenience function to determine if an expression evaluates to true or false. | Requires: CF5

queryStringToStruct

Converts a URL query string to a structure. | Requires: CF5

getCurrentPage

Returns the filename of the current URL. | Requires: CF5

CreateOrderedList

Used to create an Ordered Numeric List | Requires: CF5

queryZipFile

Reads a zip file and converts the entries into a query object (including optional binary data.) | Requires: CF6

imageScale

Returns width or height of a scaled image. | Requires: CF5

randomGenerator

This will generate the specified number of unique random numbers. | Requires: CF5

feedToQuery

Converts an RSS 0.9+, ATOM or RDF feed into a query. | Requires: CF6

getSessionList

Gets all the session keys and session ids for an application. | Requires: CF6

cfMailFactory

Reset MailSpool and access general mail settings. | Requires: CF6

getGamerCard

This function will return information about a user's XBox Live status. | Requires: CF7

generateSiteMap

Generates a valid Site Map XML from either a list of URLs or a query of URLs. | Requires: CF6

dumpVarList

Dumps out variables/structs in simple text format. | Requires: CF6

GetPrinters

Get array of available server printers (for use with CFPRINT). | Requires: CF8

bhImgInfo

Image function to return Height, Width and file size. | Requires: CF6

pause

Simulates a paused state within an executed Coldfusion script. | Requires: CF6

getCustomTagAttributes

Get an array of the attributes used in the given custom tag file. | Requires: CF6

fakesleep

Causes the current page request to "sleep" for the given duration, before continuing. | Requires: CF6

amInCFThread

returns 'true' if the currentthread is a cfthread, rerturns false otherwise | Requires: CF8

getCurrentTemplateDirectory

This function returns the current directory of your current coldfusion template. | Requires: CF5

getHostFromURLJava

Extracts the host name from a URL. | Requires: CF5

getLocaleInfo

A better version of getLocale. | Requires: CF6

webmasterEmail

creates a webmaster@... address out of any URL. | Requires: CF5

httpOrS

Returns "https" if the current browser session is via SSL, or "http" if not. | Requires: CF5

getCurrentURL

Returns the current URL for the page. | Requires: CF6

isMod10

Checks to see whether a string passed to it passes the Luhn algorithm (also known as the Mod10 algorithm) | Requires: CF5

getTinyURL

Quick and easy way to get a tinyurl. | Requires: CF5

getAllFilesInModule

Given output from a cvs ls command, this UDF returns a list of files path-qualified for CVS. | Requires: CF5

getTagListFromRLOG

returns a list of tags for a module in CVS based on passed in rlog results. | Requires: CF5

friendlyURL

UDF that returns an SEO friendly string. | Requires: CF6

cf301Redirect

Takes a url and 301 redirects to user to that url. | Requires: CF6

isMobileBrowser

Mobile browser detector. | Requires: CF7

writeStateSelect

Easily creates a state select dropdown/ | Requires: CF5

isCookiesEnabled

Returns true if browser cookies are enabled. | Requires: CF6

getSkypeStatus

Call the skype website to know the status of a user | Requires: CF6

cacheCallback

An easy way to cache the result of any UDF. | Requires: CF5

threadMurder

Programmatically kill any cfthread from any request. | Requires: CF8

serializeToJSONP

Serializes data to JSONP format for cross domain JSON requests. | Requires: CF8

returnRandomHEXColors

Generate random colors for cfcharts! | Requires: CF5

Magic8Ball

Pass this UDF a Yes/No question, and it will return a prediction. | Requires: CF5

verifyEmail

Validate an email existence using an external web service. | Requires: CF6

swfHeader

swfHeader reads a swf file's header and returns it's meta information, including height, width and Flash version. | Requires: CF6

generateSsccAsn

Serial Shipping Container Code (SSCC) ASN Generator. | Requires: CF6

ColorShade

Returns a hexadecimal color value an amount lighter or darker than the provided color. | Requires: CF5

ImageSize

Returns width and height of images based on image type. | Requires: CF6

createDestination

Creates BlazeDS destination at runtime | Requires: CF9

createEndpoint

Create channel and endpoint at runtime | Requires: CF9

excelColumnNumtoColumnName

Converts a numeric column position to its Excel Column Name | Requires: CF5

gunzipFile

Unzip a gzipped (.gz) file. | Requires: CF6

randomLastName

Returns a random last name. | Requires: CF6

randomFirstName

Returns a random first name. | Requires: CF6

getUploadData

Returns a structure containing upload information. | Requires: CF8

getUrlRelativeToWebRoot

Pass in file path to web root and a file and it returns URL relative to site root. | Requires: CF6

getFunctionHint

You give me a function and I return the hint. Useful for demo and documentation pages. | Requires: CF6

sitemapPing

Ping multiple search engines with your sitemap.xml file and get the server response. | Requires: CF8

readPropertiesFile

Load and parse a .properties file into a struct | Requires: CF6

forceBoolean

Returns a boolean 1/0 from anything, including empty strings. | Requires: CF5

MPGCalc

Calculate a vehicles Miles Per Gallon (MPG) | Requires: CF5

journeyCost

Calculates the cost of a car journey. | Requires: CF5

googleURLExpand

Reverses a URL shortened by Google's URL Shortening service. | Requires: CF8

googleURLShorten

Uses Google's URL Shortening service to shorten a URL. | Requires: CF8

parseExcel

Converts an excel file to a structure of arrays | Requires: CF8

getTwitterUser

Does a simple Twitter lookup for a user. | Requires: CF9

queryToTableDump

Simple table-based datadump from any query | Requires: CF8

getStackTrace

Gets the current stack trace, even if no error was thrown, and returns it in a query. | Requires: CF9

uCaseWordsForSolr

Works with SolrClean UDF to UCASE Solr Keywords. | Requires: CF9

heatColor

Assign a "heat" color based on value's position within the range. | Requires: CF5

excelColumnNameToColumnNumber

Converts an Excel Column Name to its numeric column position. | Requires: CF5

sigJsonToImage

A supplemental script for Signature Pad that generates an image of the signature's JSON output server-side. | Requires: CF9

checkHealth

Serve system checks for nagios or other monitoring solutions. | Requires: CF9

browserDetect

Detects 130+ browsers. | Requires: CF8

getFileSpace

Gets available and total file space for all volumes on a server. | Requires: CF6

RowColor

Returns alternating color based on list of colors. | Requires: CF5

rjustify2

Same as built-in RJUSTIFY, but allows optional parameter character to pad with. | Requires: CF5

GetFileFilterCount

Accepts a directory path & a file filter. Returns number of matching files. | Requires: CF6

quickSort

Implementation of Hoare's Quicksort algorithm for sorting arrays of arbitrary items. | Requires: CF6

LCaseStructKeys

Lower Case Structure Keys | Requires: CF5

countTrueBoolKeysInStruct

I loop through a struct that contains keys set to boolean values and return count of how many keys evaluate true. | Requires: CF8

structToKeys

Extracts the keys from a struct | Requires: CF9

solrClean

Like VerityClean, massages text input to make it Solr compatible. | Requires: CF9

sexagesimalToDecimal

Changes a sexagesimal latitude longitude co-ordinates to decimal format | Requires: CF9

formFieldAsArray

Returns a form field as array, useful for when you have more than one form field with the same name. | Requires: CF8

invokeRemoteMethodByJSON

Invoke a remote method using cfhttp and JSON proxy | Requires: CF9

isImageCMYK

Identifies CMYK images. | Requires: CF10

ClosestWebSafeColor

Returns the closest web safe hexadecimal color for a given hexadecimal color. | Requires: CF5

IsHexColor

Returns true if valid hexadecimal color. | Requires: CF5

structFindKeyWithValue

Combines structFindKey() and structFindValue() | Requires: CF9

defer

A function to hand of a job to a separate thread | Requires: CF10

makeStopwatch

Returns functions for recording a sequence of timed events | Requires: CF10

getExcelPercentile

Returns the requested percentile() | Requires: CF8

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