Possible Duplicate:
How do I trim a string in javascript?
I need to remove only the last and the first spaces from a generic string.
Example:
var str = " hello world "; // become "hello world"
var str = "ehi, do you come from ? "; // become "ehi, do you come from ?"
var str = "I am from Cina"; // remain "I am from Cina"
How can I do that ?