Nelson's response works in CF.  In JS, just did this the other day...

You could adapt this routine for yourself:
And remove blanks from the front and back   This just removes them from the
front.  
I believe if you use  -1  it will come off the back end.

for (var i=0; i<varBuilder.length; i++){
    // for space there has to be a space between the two single quotes
    if(varBuilder.charAt(i)== ' ' {
    varBuilder.value=varBuilder.substr(i+1,varBuilder.length);
    //this removes the empty space from the front. 
    }   
}


Carol L. Bluestein
Senior Programmer
NYS Office of Real Property
518-486-6335
[EMAIL PROTECTED]


____________________Reply Separator____________________
Subject:    Re: OT: Does JavaScript have a Trim function?
Author: [EMAIL PROTECTED]
Date:       12/19/00 9:24 PM

try this "Trim(string)" this will remove all white space from the beginning 
and end of your string. ex. if you have a user form field named "blahblah" 
you could write #Trim(blahblah)#.

hope this answers your questions. good luck.

cheers,

nelson


----Original Message Follows----
From: "Milks, Jim" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: CF-Talk <[EMAIL PROTECTED]>
Subject: OT: Does JavaScript have a Trim function?
Date: Tue, 19 Dec 2000 13:04:52 -0500
Received: from [207.31.122.140] by hotmail.com (3.2) with ESMTP id 
MHotMailBC08FEC500B040043113CF1F7A8C091985; Tue Dec 19 11:37:32 2000
Received: from houseoffusion.com ([207.31.122.140])          by 
www.houseoffusion.com (Post.Office MTA v3.5.3 release 223          ID# 
0-54969U100L100S0V35) with ESMTP id com          for 
<[EMAIL PROTECTED]>;          Tue, 19 Dec 2000 13:16:20 -0500
>From [EMAIL PROTECTED] Tue Dec 19 11:39:11 2000
Message-id: <0160C6B4BB54D41182AB0001024294B00682DB@EXCHANGE>

Hi All,
Just wondering if there is an easy way to trim leading and trailing spaces
with JavaScript?

Jim
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to