Both return a space, you just don't see the second space becuase you
assign the result to a variable. Actually, this is what happens:

You call test()
A space is generated
A string is returned and saved to A
You output A.

So the space is just moved.

To fix this issue, just add output=false to your cffunction tag.

========================================================================
===
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
(www.mindseye.com)
Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)

Email    : [EMAIL PROTECTED]
Blog     : www.camdenfamily.com/morpheus/blog
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

> -----Original Message-----
> From: Darron J. Schall [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 29, 2003 1:19 PM
> To: CF-Talk
> Subject: cffunction returntype="string"
> 
> 
> Can someone tell me why this happens... am I on crack, or is 
> this a CFMX bug?
> 
> <cffunction name="test" returntype="string">
>  <cfreturn "return value">
> </cffunction>
> 
> <cfoutput>"#test()#"</cfoutput> <!---  " return value" ---> 
> <cfset a = test()><br/> <cfoutput>"#a#"</cfoutput> <!--- 
> "return value" --->
> 
> Why is there a leading space when I just output test(), but 
> no leading space if I assign the result to a variable and 
> output the variable?  Additionally...
> 
> <cfoutput>"#trim(test())#"</cfoutput>
> 
> ...STILL produces a leading space.
> 
> Thoughts?
> 
> -d
> 
> 
> 
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to