Subsribe to our RSS

latest reactions

christian louboutin shoes
With that kind of traffic you want to ad …
Rahul Anand
Thanks for the nice post. It works for m …
Serkan
thx a lot! …
msb
Thanks for above solution.There is ano …
Lori S.
FYI, I was using this successfully in CF …

Use OpenDNS

mxna feeds

cfmailparam behaviour change in CF9.01ColdFusion Job Opportunity in Houston, TXFacial Recognition in 14 Lines Of ColdFusionColdFusion UPS PackageColdFusion Job Opportunity in Arlington, VAColdFusion Job Opportunity in San Diego, CASome ColdFusionBloggers.org GuidelinesColdFusion Positions In CaliforniaListChangeDelimsunix epoch with coldfusionQuery scripting bug in Coldfusion 9Scoth On The Rock 2011 Tickets on salefoursquareCFC updated to version 1.0, now includes ColdFusion return typeFramework One Birds of a Feather session at CFUnitedWhat makes you a good ColdFusion programmer?

All files are strictly confidential: all information is classified.
© Copyright 2002 - 2010 mximize.com.
All right reserved.

MXNA webfeed

Visit Carlos Gallupa

Strip whitespace

After reading a comment from Dmitry Namiot that he posted on http://weblogs.macromedia.com/cantrell/archives/2005/01/eliminate_coldf.cfm, I tried it out.. but it didn't do what I wanted. Below I changed the code a bit so that I have all the control on what to strip and what not. I didn't want the code to be on 1 line.. for that you can just use the regular expression. "[[:space:]]{2,-}"... I wanted to have a certain control on what and how my code was stripped.

Put the code below in an onRequestEnd.cfm and see what it could do for your bandwidth!! A better solution is always welcome :-)

Oh.. and the servlet idea on the above post didn't do it for me.. it had problems with RDS, cflocation etc, etc.


<!--- copy the current contents of out (which is what cfmx will send to the browser at the end of processing) --->
<cfset pageContent = getPageContext().getOut().getString()>

<!--- now we have a copy, clear the out buffer --->
<cfset getPageContext().getOut().clearBuffer()>
 
<!--- tidy up --->
<cfset pageContent = reReplace(pageContent, chr(9),"", "all" )>
<cfset pageContent = reReplace(pageContent, " ","", "all" )>
<cfset pageContent = reReplace(pageContent, chr(13)&chr(10)&chr(13)&chr(10),chr(13)&chr(10), "all" )>
<cfset pageContent = reReplace(pageContent, chr(10)&chr(13),"", "all" )>
 
<!--- send our cleaned content to the browser --->
<cfset writeOutput(pageContent)>
<cfset getPageContext().getOut().flush()>
<!--- job done! --->

3808 viewed | Your opinion...  | del.icio.us | Digg it | Tjarko @ 12/09/05 12:58 cet


Reactions:

Leave your comment

Your name


Your url/website/link/email....


Some room for your reaction is placed here..



The answer to the ultimate question is?? (42 ;-))




URL en mail addresses are translated for you... life sometimes is that simple!!