String.prototype.trim = function(){
return this.replace(/(^\s*)|(\s*$)/gi, "");
};
String.prototype.ltrim = function(){
return this.replace(/(^\s+)/, "");
};
String.prototype.rtrim = function(){
return this.replace(/(\s+$)/, "");
};
사용법은..
var str = 'ABC ' ; str.trim();
'웹 개발' 카테고리의 다른 글
| Maven Ant Tasks (0) | 2013.06.18 |
|---|---|
| 같은 소스, 같은 브라우저, 다른 서버, 다른 결과 (0) | 2013.06.17 |
| Google Analytics Script API (0) | 2012.03.07 |
| XML에서 한글 읽어들이기. (0) | 2011.12.07 |
| JSF - executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@1ae6456) threw exception (0) | 2010.11.19 |