String.prototype.format = function () { // The string containing the format items (e.g. "{0}") // will and always has to be the first argument. var theString = this; // start with the second argument (i = 1) for (var i = 0; i < arguments.length; i++) { // "gm" = RegEx options for Global search (more than one instance) // and for Multiline search var regEx = new RegExp("\\{" + (i) + "\\}", "gm"); theString = theString.replace(regEx, arguments[i]); } return theString; };
'Script 이야기' 카테고리의 다른 글
부호 있는 정수 세자리 수 처리. (0) | 2016.01.14 |
---|---|
DIV draggable (0) | 2015.11.18 |
스크립트 페이징 처리. (0) | 2015.10.20 |
Ajax 호출로 갱신된 페이지 내부의 컨텐츠 뒤로 가기 버튼 눌렀을때 갱신 (0) | 2015.08.20 |
페이지 뒤로 가기 막기 (0) | 2015.07.17 |