1/* ë¹ê³µë°± ì ê±° í¨ì */ 2//String.prototype.trim = function() { 3// return this.replace(/\s/g, ""); 4//} 5 6 7/* ë¹ê³µë°± ì²´í¬ í¨ì */ 8String.prototype.isNull = function() { 9 var this_val = this; 10 var nullState = false; 11 12 if (!typeof(this_val) || this_val == "" || this_val == null) nullState = true; 13 14 return nullState; 15} 16 17 18/* ì¼ìª½ 문ìì´ ì르기 í¨ì */ 19String.prototype.left = function(length) { 20 if (this.length <= length) { 21 return this; 22 } else { 23 return this.substring(0, length); 24 } 25} 26 27 28/* ì¤ë¥¸ìª½ 문ìì´ ì르기 í¨ì */ 29String.prototype.right = function(length) { 30 if (this.length <= length) { 31 return this; 32 } else { 33 return this.substring(this.length - length, this.length); 34 } 35} 36 37 38/* ì«ìí íì¸ í¨ì */ 39String.prototype.isNumeric = function() { 40 var this_val = String(this); 41 42 if (this_val.indexOf(" ") != -1 || this_val == "") return false; 43 else if (isNaN(this_val)) return false; 44 else return true; 45} 46Number.prototype.isNumeric = function() { 47 var this_val = String(this); 48 49 if (this_val.indexOf(" ") != -1 || this_val == "") return false; 50 else if (isNaN(this_val)) return false; 51 else return true; 52} 53 54 55/* ì²ë¨ì ì½¤ë§ ì¶ê° í¨ì */ 56String.prototype.addComma = function() { 57 var this_val = String(this); 58 59 /* 60 var output = ""; 61 62 for (var i=this_val.length; i>=0; i--){ 63 if((this_val.length-i)%3==1 && output.length!=0 && this_val.charAt(i) != "-") { 64 output = "," + output; 65 } 66 67 output = this_val.charAt(i) + output; 68 } 69 70 return output; 71 */ 72 73 var regx = new RegExp(/(-?\d+)(\d{3})/); 74 var bExists = this_val.indexOf(".", 0);//0ë²ì§¸ë¶í° .ì ì°¾ëë¤. 75 var strArr = this_val.split('.'); 76 while (regx.test(strArr[0])) {//문ìì´ì ì ê·ì í¹ì문ìê° í¬í¨ëì´ ìëì§ ì²´í¬ 77 //ì ì ë¶ë¶ìë§ ì½¤ë§ ë¬ê¸° 78 strArr[0] = strArr[0].replace(regx, "$1,$2");//콤ë§ì¶ê°í기 79 } 80 if (bExists > -1) { 81 //. ììì 문ìì´ì´ ë°ê²¬ëì§ ìì ê²½ì° -1 ë°í 82 this_val = strArr[0] + "." + strArr[1]; 83 } else { //ì ìë§ ììê²½ì° //ììì 문ìì´ ì¡´ì¬íë©´ ìì ë°í 84 this_val = strArr[0]; 85 } 86 87 return this_val;//문ìì´ ë°í 88} 89Number.prototype.addComma = function() { 90 var this_val = String(this); 91 92 /* 93 var output = ""; 94 95 for (var i=this_val.length; i>=0; i--){ 96 if((this_val.length-i)%3==1 && output.length!=0 && this_val.charAt(i) != "-") { 97 output = "," + output; 98 } 99 100 output = this_val.charAt(i) + output; 101 } 102 103 return output; 104 */ 105 106 var regx = new RegExp(/(-?\d+)(\d{3})/); 107 var bExists = this_val.indexOf(".", 0);//0ë²ì§¸ë¶í° .ì ì°¾ëë¤. 108 var strArr = this_val.split('.'); 109 while (regx.test(strArr[0])) {//문ìì´ì ì ê·ì í¹ì문ìê° í¬í¨ëì´ ìëì§ ì²´í¬ 110 //ì ì ë¶ë¶ìë§ ì½¤ë§ ë¬ê¸° 111 strArr[0] = strArr[0].replace(regx, "$1,$2");//콤ë§ì¶ê°í기 112 } 113 if (bExists > -1) { 114 //. ììì 문ìì´ì´ ë°ê²¬ëì§ ìì ê²½ì° -1 ë°í 115 this_val = strArr[0] + "." + strArr[1]; 116 } else { //ì ìë§ ììê²½ì° //ììì 문ìì´ ì¡´ì¬íë©´ ìì ë°í 117 this_val = strArr[0]; 118 } 119 120 return this_val;//문ìì´ ë°í 121} 122 123 124/* ì²ë¨ì ì½¤ë§ ì ê±° í¨ì */ 125String.prototype.removeComma = function() { 126 return this.replace(/,/g, ""); 127} 128 129 130/* ì문 ë문ì ì í í¨ì */ 131String.prototype.ucase = function() { 132 return this.toUpperCase(); 133} 134 135 136/* ì문 ì문ì ì í í¨ì */ 137String.prototype.lcase = function() { 138 return this.toLowerCase(); 139} 140 141 142/* 10ì§ì íë³í í¨ì */ 143String.prototype.toInt = function() { 144 //ì) 1,000.55 â 1000 145 var this_val = this; 146 147 if (typeof(this_val) == 'number') { 148 this_val = parseInt(this_val, 10); 149 } else { 150 if (this_val.length > 0) { 151 this_val = this_val.replace(/[^0-9]/gi, ''); 152 if (this_val.length > 0) this_val = parseInt(this_val, 10); 153 } 154 } 155 156 return this_val 157} 158 159 160/* ì«ì íë³í í¨ì */ 161String.prototype.toNumber = function() { 162 //ì) 1,000.55 â 1000.55 163 var this_val = this; 164 165 if (typeof(this_val) == 'number') { 166 this_val = Number(this_val, 10); 167 } else { 168 if (this_val.length > 0) { 169 this_val = this_val.replace(/[^0-9,.]/gi, ''); 170 this_val = Number(this_val.replace(/[^0-9.]/gi, ''), 10); 171 } 172 } 173 174 return this_val; 175} 176 177 178/* ì§ì ì리 ë°ì¬ë¦¼ */ 179String.prototype.toRound = function(pos) { 180 var this_val = this.toNumber(); 181 pos = !pos ? 0 : pos; 182 var digits = Math.pow(10, pos); 183 var sign = 1; 184 185 if (this_val < 0) sign = -1; 186 187 //ììì´ë©´ ììì²ë¦¬í ë°ì¬ë¦¼ í í ë¤ì ììì²ë¦¬ 188 this_val = this_val * sign; 189 var num = Math.round(this_val * digits) / digits; 190 num = num * sign; 191 192 return num.toFixed(pos); 193} 194 195Number.prototype.toRound = function(pos) { 196 var this_val = this; 197 pos = !pos ? 0 : pos; 198 var digits = Math.pow(10, pos); 199 var sign = 1; 200 201 if (this_val < 0) sign = -1; 202 203 //ììì´ë©´ ììì²ë¦¬í ë°ì¬ë¦¼ í í ë¤ì ììì²ë¦¬ 204 this_val = this_val * sign; 205 var num = Math.round(this_val * digits) / digits; 206 num = num * sign; 207 208 return num.toFixed(pos); 209} 210 211 212/* ì§ì ì리 ì¬ë¦¼ */ 213String.prototype.toCeil = function(pos) { 214 var this_val = this.toNumber(); 215 pos = !pos ? 0 : pos; 216 var digits = Math.pow(10, pos);
217 var num = Math.ceil(this_val * digits) / digits; 218 219 return num.toFixed(pos); 220}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.