ColdFusion function returns space before value

I had an annoying issue this morning where a function I wrote that rounds and formats values for use in an internal financial app kept sticking a single space before the value returned. This was obviously not good for a financial app. After spending 10-15 minutes tearing the function’s innards apart it turns out what was going on in the function was not the cause. The cause was simple.

In a tag based ColdFusion function you need to be sure to include the ‘output=”no”‘ attribute.

<cffunction name="RoundMoney" returntype="numeric" output="no"> 
     ... MAGIC STUFF HERE ...

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.