ColdFusion UDF Library

December 16th, 2008

Part of being a good developer is the act of working smarter and not harder. And there is no better way to accomplish this than through code reuse. Adding your own Extension Library to ColdFusion is a direct and powerful way to increase the speed and consistency of your development.

These UDFs are available royalty free and you can either pull the function you need directly from here and place it in your code, or you can download the entire Extension Library and have all these functions available as if they were built directly into ColdFusion.

If you find this library useful, take a moment to contribute one of your own functions. Because working together we can make all of our professional lives as ColdFusion developers just a bit easier.

“The important thing is not to stop questioning.” -Albert Einstein

CATEGORIES
Array Date List Math
Network Query Strings Struct
System   
ARRAY
arrayConcat
     Add two or more arrays together. You may pass any number of arrays to be concatenated.
arrayFind
     Searches an array and returns the position of a value.
ArrayFindString
     Searches inside the specified array (array_obj) for a string matching string (str)
arrayFindSubString
     Searches for a value in an array.
arrayValueCount
     Counts the number of times a value is found within an array.
DATE
DateFromNumber
     Takes a numeric value as seconds from the offset date and converts it to a datetime object
FirstDayInMonth
     Determines the day of week (Monday, Tuesday, etc.) for the first day of the month within the specified date
textDateList
     Converts the DateTime Objects you pass to it to a natural language list of dates. Pass each DateTime as a seperate argument.
TimeHoursHumanFmt
     Accepts input as hours; converts to human readable format
LIST
ListConsolidate
     Removes any repeated values from a list.
listDeleteNV
     Removes a name\value pair from a list.
listDiff
     Returns an array (in order from first to last position) of all the differences between list1 and list2.
listExclude
     Loops through xList removing any occurances in list.
listFill
     Returns a list with fillChar in place of any empty element in the list.
listFindNV
     Returns the postion of a name/value pair in a list.
listMid
     Returns a portion of a list. Similar to how MID() returns a portion of a string.
listNatural
     Converts a List into a Human Readable List
listNear
     Searches in a list for a matching value or the closest matching value.
listNVQualify
     Qualifies name\value pairs in a list by putting each value in double quotes.
listReverse
     reverses the items in a list
listSortDates
     Sorts a list by treating each item as a date
listSwitch
     Swaps the position of items in a list
MATH
preciseRound
     Rounds a number to the specified number of places
NETWORK
ipToNumber
     Converts an IP Address to a number (opposite of numberToIp)
numberToIp
     Converts a number to an IP Address (opposite of ipToNumber)
QUERY
queryArray
     Copies the specified column of a query into an array
queryConcat
     Add two or more queries together.
STRINGS
Capitalize
     Converts a string to Proper Case Formatting
htmlEncode
     Encodes HTML (similar to: htmlEditFormat)
htmlEscape
     escapes html
queryString
     queryString will analyze a string of name value pairs. It will change the value of any match in the new string, and will add any unfound name matches.
RandString
     Generate random string of specified length
StringPad
     Acceps a string and padds it
stripHTML
     Removes html tags from a string
STRUCT
structSum
     Adds up all the values in a structure
structToList
     Converts a structure to a list
SYSTEM
dump
     Wraps the functionality of cfdump in a function.
evaluateString
     Executes inline CFML from a string
execute
     Executes inline ColdFusion
FileSize
     Formats file size to specified units like KB, MB, etc.
FormatSize
     Converts a numeric size value to an appropriate string representation using bytes, kilobytes, megabytes, gigabytes, terabytes, or petabytes as needed
getDriveFromPath
     getDriveFromPath v1.0 - Returns the drive part of a full path name.
getFileExtension
     Returns file extension
getFiles
     A Java based CFML UDF to get a list of files from the specified path.
jZip
     A Java based CFML UDF to manipulate zip files.
pathToRelative
     Converts a full path to a relative one.
reScope
     Copies all variables in one scope to another
  1. No comments yet.
  1. No trackbacks yet.