happydog234
asked on
Coldfusion: Leading Space Bug
I swear, this function returns an undetectable leading space.
If I pass the function to a mid, and start at char 2, it starts on char 2 of the non-leading space version. Yet if I surrond the function like this
[#func#]
there is space between the first [ and the beginning of the ourput. No lie. I swear to god. I even tired this:
#mid(f_publish_news_get_fi lename(11) ,2,len(f_p ublish_new s_get_file name))#
and it returned it as if there was no leading space. Here is the function:
<cffunction name="f_publish_news_get_f ilename" returntype="string">
<cfargument name=id default="0">
<cfset var q1 = querynew("")>
<cfset var str = "">
<cfif id EQ 0>
<cfreturn 0>
<cfelse>
<cfquery name=q1 datasource=dramanet>
SELECT id, posted_date FROM news WHERE id = #id#
</cfquery>
<cfset str = trim("#q1.posted_date##q1. id#.html") >
<cfreturn str>
</cfif>
</cffunction>
If I pass the function to a mid, and start at char 2, it starts on char 2 of the non-leading space version. Yet if I surrond the function like this
[#func#]
there is space between the first [ and the beginning of the ourput. No lie. I swear to god. I even tired this:
#mid(f_publish_news_get_fi
and it returned it as if there was no leading space. Here is the function:
<cffunction name="f_publish_news_get_f
<cfargument name=id default="0">
<cfset var q1 = querynew("")>
<cfset var str = "">
<cfif id EQ 0>
<cfreturn 0>
<cfelse>
<cfquery name=q1 datasource=dramanet>
SELECT id, posted_date FROM news WHERE id = #id#
</cfquery>
<cfset str = trim("#q1.posted_date##q1.
<cfreturn str>
</cfif>
</cffunction>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.