latest reactions

spider
One way is to google for page which cont …
andy
you can find this tool here http://andy. …
Tjarko
Eej Walker, that's pretty cool, I will c …
Walker
Thanks for posting your thoughts. I modi …
Albert
Thanks !! …

Clicky Web Analytics
Use OpenDNS
ZERIGO DNS

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

mxna feeds

CF101 Archive: September 2007 Object Oriented PizzaJob Opening for ColdFusion Developer at Arizona State UniversityMy New Experience Getting ColdFusion Builder 2 Console WorkingCF101 Archive: February 2007 Data Table GatewaysJob Opening for Sr. ColdFusion Developer in CA/ San Fernando ValleyColdFusion Supports HTTP Verbs PUT And DELETE (As Well As GET And POST)Best wishes for the new FuseboxCF101 Archive: January 2007 Data Access ObjectsOpen Source Conference For CFML DevelopersSkype Blocking Web Services with IIS, ColdFusion & RailoCF101 Archive: October 2006 Five Cool Things with ColdFusionGenerate a tag cloud from an RSS feed with ColdFusionColdFusion MeetUp: Cloudy with a Chance of Tests, with Mike HenkeReminder - Adobe CookbooksCF101 Archive: September 2006 A first look at FusionDebug

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

Visit Carlos GallupaMXNA webfeed

Trim javascript function

function trim(str) {
  str = str.replace( /^\s+/g, "" ); // strip leading
  str = str.replace( /\s+$/g, "" ); // strip trailing

  return str;
}

UPDATE: This is a Javascript function that I use to strip values. In ColdFusion you can use the standard trim() function.

<cfset var = trim(variables.x)>

or ltrim (left) / rtrim (right) functions

10946 viewed | 3 opinion(s)  | del.icio.us | Digg it | Tjarko @ 23/06/05 10:05 cet


Reactions:

Bryan F. Hogan wrote.... (site)

Um, what is the language your applying this to? ActionScript, CF, etc?

If it's CF no need for all the extra work just use trim() built in.

13 September 2005 11:29 cet  

Tjarko wrote.... (site)

Sorry.. this is javascript. There is no trim() function in javascript and I wanted that :-)

13 September 2005 12:51 cet  

Bill wrote.... (site)

You can also use this alternate approach to extend the String class (in javascript still)

String.prototype.trim = function() {
return this.replace(/^\s*|\s*$/g, "")
}

13 September 2005 18:31 cet  

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