javascript trim space removal function implementation code
http://www.jb51.net/article/16250.htm
The following is the enhanced version
// Function: 1) Remove all spaces before and after the string
// 2) Remove characters All spaces in the string (including spaces in the middle, you need to set the second parameter to: g)
function Trim(str,is_global)
{
var result;
result = str.replace(/( ^s )|(s $)/g,"");
if(is_global.toLowerCase()=="g")
result = result.replace(/s/g,"");
return result;
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn