What Is a User-Defined Function?
Before going further, you’ll need to understand what a user-defined function is. In simplest terms, a UDF is a way to assign a name to a chunk of code. When you use that name, ColdFusion will know to execute its associated code. Functions can accept arguments, and they should always return a value (although it is possible to write a UDF that doesn’t return anything). UDFs operate in the same manner as built-in functions, except that you must provide the code behind the function. If you find that you are using a similar block of code many times over in your application(s), then you will probably benefit from putting that code in a function. ColdFusion provides many different string processing functions, but one I was surprised not to find is a ProperCase function. A ProperCase function is one that will capitalize the first letter of each word in a string, and lowercase all other letters. Often when displaying data, such as someone’s name, you’ll want to make sure that it is formatted pr
Related Questions
- Im trying to access one of the standard CGI variables (such as $DOCUMENT_ROOT or $HTTP_REFERER) in a user-defined function, and it can seem to find it. Whats wrong?
- How to call one user-defined function or multiple user-defined functions from Ch?
- I wrote a user-defined function. When I run it in psql, why does it dump core?