latest reactions

David Levin
Does the trim still work if the form fie …
mal
as long as the join keys are same in eac …
Tarida
I am using ipinfodb.com to redirect the…
David Levin
Good stuff. For those interested in a UD …
PtcBux
oh Wilbur Gans wrote thank you so much…

Clicky Web Analytics
Use OpenDNS
ZERIGO DNS

Ultimate dns hosting based on pre-defined templates, DNS redirection and lot's more.

mxna feeds

Strange Interaction Between DeserializeJson(), ArrayContains(), And Database Values In ColdFusionNot able to apply Hotfix from ColdFusion 10 Administrator on Windows with Lockdown guide imposed on server. How to setInfinite Scroll Example with ColdFusionColdFusion Summit 2013ColdFusion Dev Needed: Albany, NYCF911: New Adobe document about #ColdFusion security hotfixes: required reading, I'd sayColdFusion Summit AnnouncedAdobe Announces ColdFusion Summit 2013Circular Thumbnails with ColdFusion / CSSColdFusion Dev needed: South FloridaeBay Looking for a ColdFusion DeveloperFace Cropped Thumbnails with ColdFusionUsing A Dynamic Column Name With ValueList() In ColdFusionColdFusion LockdownFace Detection with ColdFusion and Jviolajones

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

Visit Carlos GallupaMXNA webfeed

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! --->

6259 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!!