What Is a User-Defined Function?

function User-defined
0
Posted

What Is a User-Defined Function?

0

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