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) );
}

------------------------------------------------------------------------------------------------------

Comments

Popular posts from this blog

Read Images from a xlsx file using Apache POI

Struts 2 : Warning :No configuration found for the specified action: 'Login.action' in namespace: '/'

How to create mail message in FRC822 format