Author Topic: Trim string in Java script  (Read 5053 times)

Offline admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 296
    • View Profile
Trim string in Java script
« on: June 23, 2010, 07:52:31 PM »
Actually Java Script doesn't have a Trim function but we can do that using regular expressions as:

Code: [Select]
var str="   some string  ";
str = str.replace(/^\s+|\s+$/g,"");