Click to See Complete Forum and Search --> : triming problem
buddu
Aug 10th, 2001, 12:25 AM
hi there
how to trim the word using the javascript.
i mean
x=" Content"
resuld has to x="Content"
how to do this using javascript
my code is var s=new String(x);
m=s.trim();
I got the Error: Object not found;
please help me
buddu
TiPeRa
Aug 10th, 2001, 12:44 PM
Use trim in a VBScript function.
Psyrus
Aug 10th, 2001, 03:52 PM
I wrote this a little while back:
function Trim(strString){
//Trim() function removes spaces at either end
//of the string and removes all extra spaces
var strSplit; //Array of arg string split on spaces
var strReturnString; //String to return
// Split the string on all spaces.
//All spaces are discarded and only
//the characters remain.
// /\s+/ is a Regular Expression that
//represents a space character
strSplit = strString.split(/\s+/);
//Rejoin the string using a space.
strReturnString = strSplit.join(" ");
return strReturnString;
}//end function
Try it out and let me know if it works for you...
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.