JavaScript Code to trim any string (or Remove spaces from string)

Posted by Virendradugar under JavaScript category on | Views : 17139
This function removes the spaces from the string value. It removes from both the side and then returns the updated value.

  function Trim(sInString)
sInString = sInString.replace( /^\s+/g, "" );// strip leading
return sInString.replace( /\s+$/g, "" );// strip trailing

Comments or Responses

Login to post response