반응형
javascript에서 trim() 공백없애기 만들어쓰자
<script type="text/javascript">
String.prototype.trim = function() {
return this.replace(/(^\s*)|(\s*$)/gi, "");
}
</script>
var strTest = " Trim Test ";
var strResult = strTest.trim();
반응형
'프로그래밍 > Script' 카테고리의 다른 글
| TidyTime.js: A friendlier way to display time (0) | 2013.10.11 |
|---|---|
| NPM - Node.js를 구성하는 에코시스템 (0) | 2013.10.08 |
| Best jQuery Plugins of the Week [29th September-5th October] (0) | 2013.10.08 |
| [jQuery] jQuery.Pin: Pin text to your pages (0) | 2013.10.07 |
| [javascript] Animo.js: CSS animation management with JavaScript (0) | 2013.10.01 |
