Skip to main content
Inspiring
April 30, 2010
Question

cffunction returns space

  • April 30, 2010
  • 1 reply
  • 553 views

Hi,

I am using coldfusionmx6 and created function.while it calling in xml it giving space.How to delete space?

<cffunction name="datereplaceformat" returntype="string">
  <cfargument default="" name="datechange" required="No">
   <cfargument default="" name="formatchange" required="No">
<CFSET var SDATE=reREPLACE(datechange,"#formatchange#"," ","all")>
<CFSET var rspace=reREPLACE(SDATE," ","","all")>
<cfreturn rspace>
</cffunction>

sample xml:

<cfoutput>

<va4>

<datepost>#trim(datereplaceformat(variables.NotPostedTransDate,"/"))#</datepost>

</va4>

</cfoutput>

In posting page it showing as

<va4>

<datepost>

10302010

</datepost>

</va4>

Advance Thanks

This topic has been closed for replies.

1 reply

ilssac
Inspiring
April 30, 2010

Adding the output="no" property to the the <cffunction...> tag so that ColdFusion does not include any whitespace from the function may help.

You may also want to consider some of ColdFusion's other whitespace management features.  <cfsilent>...</cfsilent>  <cfsetting enableCFoutputOnly="Yes"> being a couple of the most utilized.