trim() function Java Script
Use these function in Java Script body :
----------------------------------------------------------------------------------------------------
function trim(stringToTrim) {
return stringToTrim.replace(/^\s+|\s+$/g,"");
}
return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function TestTrimString(){
var testString=" Hello! "
document.write("String before triming:" + testString );
document.write("String after triming:" + trim(testString) );
}
------------------------------------------------------------------------------------------------------
Comments
Post a Comment