View Single Post
  #1 (permalink)  
Old October 12th, 2006, 02:45 AM
kokuthanda kokuthanda is offline
Registered User
 
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to kokuthanda Send a message via Yahoo to kokuthanda
Default javascript string Trim() frunction

Hi,

Here is the smart Javascript function for remove additional spaces from a string using regular expressions

function Trim(s) {
    var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);
    return (m == null) ? "" : m[1];
}

Enjoy and share this with your friends.




Suresh Kumar Thanda
Microsoft Application Developer
Sr .Net Developer
Reply With Quote