How to trim string value :: JavaScript Tutorial

hi all..
hope everything is good at your end ..
today, there is a smal tip for javascript users …
umm infact not a tip but a utility function to trim string values ..
i was working on a project i had a need to trim user input befor submitting to server side
here is the quick way to do this .
<script type=”text/javascript” language=”javascript”>function trim(paramString){return paramString.replace(/^\s*/, “”).replace(/\s*$/, “”);}</script>
and thats it …
happy development 🙂