Misc
                
              [퍼온 글] javascript trim
                hyoyoung.dev
                 2012. 1. 5. 13:13
              
                          
            1.
javascript에는 공백제거를 하는 trim함수가 없다 ;;
그래서 정규표현식을 사용하여 공백을 제거한다.
정규표현식
^ - 처음시작(beginning of line)
\s - 공백(whitespace character)
$ - 끝라인(end of line)
원글
http://junyong.tistory.com/31
            
                          
            
            function trim(str) { 
2. return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');3.}4.String.prototype.trim = function() {5. return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');6.}그래서 정규표현식을 사용하여 공백을 제거한다.
정규표현식
^ - 처음시작(beginning of line)
\s - 공백(whitespace character)
$ - 끝라인(end of line)
원글
http://junyong.tistory.com/31