일반 String 에 trim() 함수 적용하기

황제낙엽 2011.08.28 19:50 조회 수 : 1057

sitelink1  
sitelink2  
sitelink3  
sitelink4 http://1 
extra_vars4 ko 
extra_vars5 http://www.delphifaq.com/faq/f1031.shtml 
extra_vars6 sitelink1 
String.prototype.trim = function() {
    return this.replace(/^s*/, "").replace(/s*$/, "");
};

call by value 이기 때문에 원본값은 그대로 유지하고 함수의 return value 만 trim 이 되어 반환된다
번호 제목 글쓴이 날짜 조회 수
126 Function.apply() 와 Function.call() file 황제낙엽 2011.10.07 975
» String 에 trim() 함수 적용하기 황제낙엽 2011.08.28 1057
124 javascript array contains method 황제낙엽 2011.08.19 974
123 daumopeneditor 황제낙엽 2011.07.18 979
122 object clone 황제낙엽 2011.07.08 2721
121 YUI Compressor in Java file 황제낙엽 2011.07.04 1172
120 iframe auto resize (cross browsing) 황제낙엽 2011.05.13 2092
119 자바스크립트 정렬(javascript formatter) 도구 JavaScript Code Improver file 황제낙엽 2011.04.04 1023
118 Why does this simple Javascript prototype not work in IE? 황제낙엽 2011.03.24 1206
117 Defining classes and inheritance (클래스 정의와 상속) 황제낙엽 2011.03.24 1131
116 User Agent 관련 Reference URL 황제낙엽 2011.02.22 1081
115 각 브라우저 별 User Agent 정보 황제낙엽 2011.02.22 1885
114 History of User Agent 황제낙엽 2011.02.22 1033
113 Navigator 객체란? 황제낙엽 2011.02.22 876
112 Understanding User-Agent Strings 황제낙엽 2011.02.22 1074
111 User Agent 정보 모음 file 황제낙엽 2011.02.22 14386
110 ActiveX 설치 여부를 검사하는 스크립트 황제낙엽 2011.02.13 5141
109 [JavaScript Tutorials] Error handling in JavaScript using try/catch/finally - The Error object and throwing your own errors (해석중) 황제낙엽 2009.04.10 955
108 [JavaScript Tutorials] More leakage patterns (해석중) 황제낙엽 2009.04.10 1020
107 [JavaScript Tutorials] Introducing the closure (해석중) 황제낙엽 2009.04.10 1791