PageSourceSearch

https://www.iaai.or.kr/module/js/fn.user.define.js

js iaai.or.kr collected 2026-10-09 04:46:09 UTC 5,422 bytes, 220 lines download raw bytes

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.