Write a function, to clear a space before and after the string (compatible with all browsers)

        function trim1(str){
            return str.replace(/(^\s*)|(\s*$)/g,"");
        }

 

Guess you like

Origin www.cnblogs.com/wuqilang/p/11367018.html