trim() function Java Script

Use these function in Java Script body :
function trim(stringToTrim) {
    return stringToTrim.replace(/^\s+|\s+$/g,"");

function TestTrimString(){
     var testString="  Hello!  "
    document.write("String before  triming:" + testString );  
    document.write("String after     triming:" + trim(testString) );


Popular posts from this blog

Can not connect to git using ssh (Permissions 0644 for '/root/.ssh/id_rsa' are too open.

Upload file on Google cloud storage using Java servlet on google app engine

Android: where to run keytool command in android