PageSourceSearch

https://www.ecomfort.jp/client_info/ECOMFORTHOUSE/view/userweb/js/UtilTools.js?timestamp=1749041160201

js ecomfort.jp collected 2026-10-04 13:23:19 UTC 33,451 bytes, 1,043 lines download raw bytes

1/************************************************************************
2 *************************************************************************
3 *
4 * Util Tools
5 *
6 *
7 *
8 ■javascript機能追加
9 ・trimの有効化
10 ・Object.keysの有効化
11 ・dirname 対象URLのディレクトリ名取得
12 ・dirname 対象URLのディレクトリ名取得(相対パス対応、絶対パスに変換)
13 ・basename URLからファイル名取得
14
15
16 ■コンバート用Util
17 ・URLパラメータ取得
18 ・cookie取得(単一値)
19 ・cookie取得(全て)
20 ・cookie削除
21 ・全角 → 半角
22 ・半角 → 全角
23 ・大文字 → 小文字
24 ・小文字 → 大文字
25 ・URLエンコード
26 ・URLデコード
27 ・桁埋め
28 ・日付の足し算/引き算(2015/11/30 + 7日)
29 ・日付期間計算(2015/11/30 ~ 2015/12/15 = 15)
30 ・日付フォーマット変換
31 ・日付取得(年/月/日/曜日/時間/分/秒)
32 ・少数(切り上げ/切り捨て/四捨五入/丸め)
33 ・正規表現(文字列からパターン作成)
34 ・文字列から数値を切り抜く
35 ・桁数カンマ区切り
36 ・Date型の曜日を取得
37 ・共通の値を抽出する(Object)
38 ・共通の値を抽出する(Array)
39
40
41 ■チェック用Util
42 ・型判定(Object)
43 ・型判定(Array)
44 ・型判定(Function)
45 ・型判定(Error)
46 ・型判定(Date)
47 ・型判定(JSON)
48 ・型判定(RegExp)
49 ・型判定(String)
50 ・型判定(Number)
51 ・型判定(Boolean)
52 ・型判定
53 ・半角
54 ・半角英数
55 ・半角英数記号(ASCII) http://windyrings.jugem.jp/?eid=835
56 ・半角カナ
57 ・全角
58 ・全角カナ
59 ・数値
60 ・少数
61 ・メールアドレス
62 ・電話番号
63 ・携帯番号
64 ・日付(年月日)
65 ・時刻
66 ・確認項目(パスワード、アドレスの確認があっているか)
67 ・URL
68 ・郵便番号
69 ・クレジットカード
70
71 ・null
72 ・空
73 ・undefined
74 ・0
75 ・isset
76
77 ・文字数上限/下限
78 ・機種依存文字
79 ・日付期間のチェック(開始~終了)
80 ・数値範囲
81 ・ページ判定
82 ・ページ判定(正規表現)
83
84
85 ■タグ変換
86 ・タグ変換(文字列などの配列 → selectboxなど)
87
88
89 *
90 *
91 *************************************************************************
92 *************************************************************************/
93
94function UtilTools() {}
95var Util = new UtilTools();
96
97
98
99/*=======================================================================
100=========================================================================
101=
102= 機能追加
103=
104=========================================================================
105========================================================================/
106
107/*-----------------------------------------------------------------------
108- trimの有効化
109-----------------------------------------------------------------------*/
110if(!String.prototype.trim) {
111  String.prototype.trim = function () {
112    return this.replace(/^\s+|\s+$/g,'');
113  };
114}
115
116/*-----------------------------------------------------------------------
117- Object.keysの有効化
118-----------------------------------------------------------------------*/
119if(!Object.keys){
120  Object.keys = function(obj){
121    var keys = [];
122    for(var i in obj){
123      if(obj.hasOwnProperty(i)){
124        keys.push(i);
125      }
126    }
127    return keys;
128  };
129}
130
131/*-----------------------------------------------------------------------
132- dirname 対象URLのディレクトリ名取得 [data=str;]
133-----------------------------------------------------------------------*/
134UtilTools.prototype.dirname = function(data) {
135  return data.replace(/\\/g,'/').replace(/\/[^\/]*$/, '') + '/';
136}
137
138/*-----------------------------------------------------------------------
139- dirname 対象URLのディレクトリ名取得(相対パス対応、絶対パスに変換) [data=str;]
140-----------------------------------------------------------------------*/
141UtilTools.prototype.dirnameRelative = function(data) {
142  var dirname = UtilTools.prototype.dirname(data);
143  // プロトコルとホスト削除
144  dirname = dirname.replace( location.protocol + '//' + location.host + '/', '' );
145
146  return dirname;
147}
148
149/*-----------------------------------------------------------------------
150- basename URLからファイル名取得 [data=str;]
151-----------------------------------------------------------------------*/
152UtilTools.prototype.basename = function(data) {
153  var filename = data.replace(/\\/g,'/').replace( /.*\//, '' );
154
155  // クエリ削除
156  filename = filename.split('?');
157  filename = filename.shift();
158
159  // ハッシュ削除
160  filename = filename.split('#');
161  filename = filename.shift();
162
163  return filename;
164}
165
166
167
168/*=======================================================================
169=========================================================================
170=
171= コンバート用
172=
173=========================================================================
174========================================================================/
175
176/*-----------------------------------------------------------------------
177- URLパラメータ取得(連想配列で返す) [data=str;]
178-----------------------------------------------------------------------*/
179UtilTools.prototype.getQueryParams = function(data) {
180
181  var queryString, queryItems, queryItem,
182    i, length, matchs, key, pkey, skey, value, list, hash, params = {};
183
184  // クエリストリングの取得
185  if(arguments.length){
186    queryString = data;
187  }else{
188    queryString = window.location.search || '';
189  }
190  queryString = queryString.substr(1, queryString.length);
191
192  // パラメター毎に分解
193  queryItems = queryString.split('&');
194
195  // 各パラメターをキー&バリューに分解
196  for (i = 0, length = queryItems.length; i < length; i++) {
197    // 1組取り出し
198    queryItem = (queryItems[i] || '').split('=');
199
200    // キー&バリューに分解
201    key = queryItem[0];
202    value = queryItem[1] ? queryItem[1] : '';
203
204    // キー文字列によってオブジェクトの作り方を変える
205    matchs = (/([\w$]*)\[([\w$]*)\]/g).exec(key);
206    if (matchs === null) {
207      // 単純なキー&バリュー
208      params[key] = value;
209    } else {
210      pkey = matchs[1];
211      skey = matchs[2];
212      if (!skey) {
213        // 配列にバリューを格納
214        list = params[pkey] = params[pkey] || [];
215        list[list.length] = value;
216      } else {
217        // ハッシュにサブキーとバリューを格納
218        hash = params[pkey] = params[pkey] || {};
219        hash[skey] = value;
220      }
221    }
222  }
223
224  return params;
225
226}
227
228
229/*-----------------------------------------------------------------------
230- cookie取得(単一値) [name=cookie名;]
231-----------------------------------------------------------------------*/
232UtilTools.prototype.getCookie = function(name) {
233  var result = null;
234  if(UtilTools.prototype.isEmpty(name)){
235    return result;
236  }
237
238  var cookieName = encodeURIComponent(name) + '=';
239  var allCookies = document.cookie;
240
241  var position = allCookies.indexOf(cookieName);
242  if( ~position ){
243    var startIndex = position + cookieName.length;
244    var endIndex = allCookies.indexOf(';', startIndex);
245    if(endIndex == -1){
246      endIndex = allCookies.length;
247    }
248
249    result = decodeURIComponent(allCookies.substring( startIndex, endIndex ));
250  }
251
252  return result;
253}
254
255
256/*-----------------------------------------------------------------------
257- cookie取得(全て)
258-----------------------------------------------------------------------*/
259UtilTools.prototype.getCookies = function() {
260  var result = {};
261  var allCookies = document.cookie;
262  if(allCookies != ''){
263    var cookies = allCookies.split( '; ' );
264    for(var i = 0; i < cookies.length; i++){
265      var cookie = cookies[i].split('=');
266      // クッキーの名前をキーとして 配列に追加する
267      result[decodeURIComponent(cookie[0])] = decodeURIComponent(cookie[1]);
268    }
269  }
270  return result;
271}
272
273
274/*-----------------------------------------------------------------------
275- cookie設定 [name=cookie名;value=値;setting={各種設定}]
276-             settingの設定内容は以下の通り
277-               path    : クッキーが有効なパス ext) /foo/
278-               domain  : クッキーが有効なドメイン ext) example.com
279-               max-age : クッキーの有効期限 (秒数で指定) ext) 3600
280-               secure  : HTTPS接続でのみクッキーを使用するかどうか ext) true
281-----------------------------------------------------------------------*/
282UtilTools.prototype.setCookie = function(name, value, setting) {
283  var cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value);
284
285  // 設定内容がセットされているか判定(構造体か判定)
286  if(setting instanceof Object && !(setting instanceof Array)){
287
288    // 有効なpathの設定
289    if(UtilTools.prototype.isSet(setting['path'])){
290      cookie += '; path=' + setting['path'];
291    }
292
293    // 有効なdomainの設定
294    if(UtilTools.prototype.isSet(setting['domain'])){
295      cookie += '; domain=' + setting['domain'];
296    }
297
298    // 有効期限
299    if(UtilTools.prototype.isSet(setting['max-age'])){
300      cookie += '; max-age=' + setting['max-age'];
301    }
302
303    // HTTPS接続のみでの使用設定
304    if(UtilTools.prototype.isSet(setting['secure'])){
305      cookie += '; secure=' + setting['secure'];
306    }
307  }
308
309  document.cookie = cookie;
310}
311
312
313/*-----------------------------------------------------------------------
314- cookie削除 [name=cookie名;]
315-----------------------------------------------------------------------*/
316UtilTools.prototype.deleteCookie = function(name, setting) {
317  // 空のcookieをセット
318  var cookie = encodeURIComponent(name) + '=';
319
320  // 設定内容がセットされているか判定(構造体か判定)
321  if(setting instanceof Object && !(setting instanceof Array)){
322
323    // 有効なpathの設定
324    if(UtilTools.prototype.isSet(setting['path'])){
325      cookie += '; path=' + setting['path'];
326    }
327
328    // 有効なdomainの設定
329    if(UtilTools.prototype.isSet(setting['domain'])){
330      cookie += '; domain=' + setting['domain'];
331    }
332
333    // HTTPS接続のみでの使用設定
334    if(UtilTools.prototype.isSet(setting['secure'])){
335      cookie += '; secure=' + setting['secure'];
336    }
337  }
338  // 有効期限を0とすることでクッキーを削除
339  cookie += '; max-age=0';
340
341  document.cookie = cookie;
342}
343
344
345/*-----------------------------------------------------------------------
346- 全角 → 半角 [data=str;]
347-----------------------------------------------------------------------*/
348UtilTools.prototype.convertToHalf = function(data) {
349  return data.replace(/[A-Za-z0-9]/g, function(s) {
350    return String.fromCharCode(s.charCodeAt(0) - 0xFEE0);
351  });
352}
353
354
355/*-----------------------------------------------------------------------
356- 半角 → 全角 [data=str;]
357-----------------------------------------------------------------------*/
358UtilTools.prototype.convertToFull = function(data) {
359  return data.replace(/[A-Za-z0-9]/g, function(s) {
360    return String.fromCharCode(s.charCodeAt(0) + 0xFEE0);
361  });
362}
363
364
365/*-----------------------------------------------------------------------
366- 大文字 → 小文字 [data=str;]
367-----------------------------------------------------------------------*/
368UtilTools.prototype.convertToLower = function(data) {
369  return data.toLowerCase();
370}
371
372
373/*-----------------------------------------------------------------------
374- 小文字 → 大文字 [data=str;]
375-----------------------------------------------------------------------*/
376UtilTools.prototype.convertToUpper = function(data) {
377  return data.toUpperCase();
378}
379
380
381/*-----------------------------------------------------------------------
382- URLエンコード [data=str;]
383-----------------------------------------------------------------------*/
384UtilTools.prototype.encodeUri = function(data) {
385  return encodeURIComponent(data);
386}
387
388
389/*-----------------------------------------------------------------------
390- URLデコード [data=str;]
391-----------------------------------------------------------------------*/
392UtilTools.prototype.decodeUri = function(data) {
393  return decodeURIComponent(data);
394}
395
396
397/*-----------------------------------------------------------------------
398- 桁埋め [num=int,str; digit=int;]
399-----------------------------------------------------------------------*/
400UtilTools.prototype.Ketaume = function(num, digit) {
401
402  // 0ケタ以下の表示は不可能なためそのままnumを返す
403  if(digit < 1)
404    return num;
405
406
407  var ketaumeStr = '0';
408  var zero = '';
409
410  for(var i=1; i<digit; i++){
411    zero += ketaumeStr;
412  }
413
414  var result = ( zero + num ).slice( -digit );
415  return result;
416
417}
418
419
420/*-----------------------------------------------------------------------
421- 正規表現(文字列からパターン作成) [str=str;]
422-----------------------------------------------------------------------*/
423UtilTools.prototype.StrToRegexPattern = function(str) {
424
425  var result = new RegExp(str);
426  return result;
427
428}
429
430
431/*-----------------------------------------------------------------------
432- 文字列から数値を切り抜く [str=str;]
433-----------------------------------------------------------------------*/
434UtilTools.prototype.getNumberFromString = function(data) {
435  var result = data.replace(/[^0-9]/g,'') - 0;
436  return result;
437}
438
439
440/*-----------------------------------------------------------------------
441- 桁数カンマ区切り [str=str,int;]
442-----------------------------------------------------------------------*/
443UtilTools.prototype.addCommaSeparat = function(data) {
444  var result = data.toString().replace( /(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
445  return result;
446}
447
448
449/*-----------------------------------------------------------------------
450- Date型の曜日を取得する [data=Date,int]
451-----------------------------------------------------------------------*/
452UtilTools.prototype.getWeekday = function(data) {
453  var week = ["日","月","火","水","木","金","土"];
454  // 引数が日付型の場合
455  if(UtilTools.prototype.isTypeDate(data)){
456    return week[data.getDay()];
457  }
458  // 引数が整数の場合
459  if(UtilTools.prototype.isTypeNumber(data) && UtilTools.prototype.isBetweenNum(data, 0, 6)){
460    return week[data];
461  }
462
463  // 引数が想定外の場合はnull
464  return null;
465}
466
467
468/*-----------------------------------------------------------------------
469- 共通の値を抽出する(Object) [obj1=object;obj2=object]
470-----------------------------------------------------------------------*/
471UtilTools.prototype.getCommonObjectData = function(obj1, obj2) {
472
473  var commonValueObject = {};
474
475  // どちらかがオブジェクトではない場合処理終了
476  if(!UtilTools.prototype.isTypeObject(obj1) || !UtilTools.prototype.isTypeObject(obj2)){
477    return commonValueObject;
478  }
479
480  // 全てのオブジェクトを比較し、同一値のものを共通項目とする
481  for(var key in obj1){
482    if(obj1[key] != null && obj1[key] == obj2[key]){
483      commonValueObject[key] = obj1[key];
484    }
485  }
486
487  return commonValueObject;
488}
489
490
491/*-----------------------------------------------------------------------
492- 共通の値を抽出する(Array) [arr1=array;arr2=array]
493-----------------------------------------------------------------------*/
494UtilTools.prototype.getCommonArrayData = function(arr1, arr2) {
495
496  var commonValueArray = [];
497
498  // どちらかが配列ではない場合処理終了
499  if(!UtilTools.prototype.isTypeArray(arr1) || !UtilTools.prototype.isTypeArray(arr2)){
500    return commonValueArray;
501  }
502
503  // 全ての配列を比較し、同一値のものを共通項目とする
504  for(var i=0; i<arr1.length; i++){
505
506    for(var j=0; j<arr2.length; j++){
507
508      if(arr1[i] == arr2[j] && commonValueArray.indexOf(arr1[i]) < 0){
509        commonValueArray.push(arr1[i]);
510      }
511
512    }
513
514  }
515
516  return commonValueArray;
517}
518
519
520
521/*=======================================================================
522=========================================================================
523=
524= チェック用
525=
526=========================================================================
527========================================================================/
528
529/*-----------------------------------------------------------------------
530- 型判定(Object) [data=object;]
531-----------------------------------------------------------------------*/
532UtilTools.prototype.isTypeObject = function(data) {
533  var type = "Object";
534  return UtilTools.prototype.isType(data, type);
535}
536
537
538/*-----------------------------------------------------------------------
539- 型判定(Array) [data=object;]
540-----------------------------------------------------------------------*/
541UtilTools.prototype.isTypeArray = function(data) {
542  var type = "Array";
543  return UtilTools.prototype.isType(data, type);
544}
545
546
547/*-----------------------------------------------------------------------
548- 型判定(Function) [data=object;]
549-----------------------------------------------------------------------*/
550UtilTools.prototype.isTypeFunction = function(data) {
551  var type = "Function";
552  return UtilTools.prototype.isType(data, type);
553}
554
555
556/*-----------------------------------------------------------------------
557- 型判定(Error) [data=object;]
558-----------------------------------------------------------------------*/
559UtilTools.prototype.isTypeError = function(data) {
560  var type = "Error";
561  return UtilTools.prototype.isType(data, type);
562}
563
564
565/*-----------------------------------------------------------------------
566- 型判定(Date) [data=object;]
567-----------------------------------------------------------------------*/
568UtilTools.prototype.isTypeDate = function(data) {
569  var type = "Date";
570  return UtilTools.prototype.isType(data, type);
571}
572
573
574/*-----------------------------------------------------------------------
575- 型判定(JSON) [data=object;]
576-----------------------------------------------------------------------*/
577UtilTools.prototype.isTypeJSON = function(data) {
578  var type = "JSON";
579  return UtilTools.prototype.isType(data, type);
580}
581
582
583/*-----------------------------------------------------------------------
584- 型判定(RegExp) [data=object;]
585-----------------------------------------------------------------------*/
586UtilTools.prototype.isTypeRegExp = function(data) {
587  var type = "RegExp";
588  return UtilTools.prototype.isType(data, type);
589}
590
591
592/*-----------------------------------------------------------------------
593- 型判定(String) [data=object;]
594-----------------------------------------------------------------------*/
595UtilTools.prototype.isTypeString = function(data) {
596  var type = "String";
597  return UtilTools.prototype.isType(data, type);
598}
599
600
601/*-----------------------------------------------------------------------
602- 型判定(Number) [data=object;]
603-----------------------------------------------------------------------*/
604UtilTools.prototype.isTypeNumber = function(data) {
605  var type = "Number";
606  return UtilTools.prototype.isType(data, type);
607}
608
609
610/*-----------------------------------------------------------------------
611- 型判定(Boolean) [data=object;]
612-----------------------------------------------------------------------*/
613UtilTools.prototype.isTypeBoolean = function(data) {
614  var type = "Boolean";
615  return UtilTools.prototype.isType(data, type);
616}
617
618
619/*-----------------------------------------------------------------------
620- 型判定 [data=object;type=str;]
621-----------------------------------------------------------------------*/
622UtilTools.prototype.isType = function(data, type) {
623  var toString = Object.prototype.toString;
624  if(toString.call(data).slice(8, -1) == type){
625    return true
626  }
627  return false;
628}
629
630
631/*-----------------------------------------------------------------------
632- 半角 [data=str;]
633-----------------------------------------------------------------------*/
634UtilTools.prototype.isHankaku = function(data) {
635  for (var i = 0; i < data.length; i++) {
636    var c = data.charCodeAt(i);
637    // Shift_JIS: 0x0 ~ 0x80, 0xa0 , 0xa1 ~ 0xdf , 0xfd ~ 0xff
638    // Unicode : 0x0 ~ 0x80, 0xf8f0, 0xff61 ~ 0xff9f, 0xf8f1 ~ 0xf8f3
639    if ( !((c >= 0x0 && c < 0x81) || (c == 0xf8f0) || (c >= 0xff61 && c < 0xffa0) || (c >= 0xf8f1 && c < 0xf8f4)) ) {
640      return false;
641    }
642  }
643  return true;
644}
645
646
647/*-----------------------------------------------------------------------
648- 半角英数 [data=str;]
649-----------------------------------------------------------------------*/
650UtilTools.prototype.isHankakuEisuu = function(data) {
651  var pettern = /^[A-Za-z0-9]+$/;
652  if(data.toString().match(pettern))
653    return true;
654  else
655    return false;
656}
657
658
659/*-----------------------------------------------------------------------
660- 半角英数記号 [data=str;]
661-----------------------------------------------------------------------*/
662UtilTools.prototype.isHankakuEisuuKigou = function(data) {
663  var pettern = /^[a-zA-Z0-9!-/:-@\[-`{-~]+$/;
664  if(data.toString().match(pettern))
665    return true;
666  else
667    return false;
668}
669
670
671/*-----------------------------------------------------------------------
672- 半角カナ [data=str;]
673-----------------------------------------------------------------------*/
674UtilTools.prototype.isHankakuKana = function(data) {
675  var pettern = /^[ァ-ン゙゚]+$/;
676  if(data.toString().match(pettern))
677    return true;
678  else
679    return false;
680}
681
682
683/*-----------------------------------------------------------------------
684- 全角 [data=str;]
685-----------------------------------------------------------------------*/
686UtilTools.prototype.isZenkaku = function(data) {
687  for (var i = 0; i < data.length; i++) {
688    var c = data.charCodeAt(i);
689    // Shift_JIS: 0x0 ~ 0x80, 0xa0 , 0xa1 ~ 0xdf , 0xfd ~ 0xff
690    // Unicode : 0x0 ~ 0x80, 0xf8f0, 0xff61 ~ 0xff9f, 0xf8f1 ~ 0xf8f3
691    if ( (c >= 0x0 && c < 0x81) || (c == 0xf8f0) || (c >= 0xff61 && c < 0xffa0) || (c >= 0xf8f1 && c < 0xf8f4)) {
692      return false;
693    }
694  }
695  return true;
696}
697
698
699/*-----------------------------------------------------------------------
700- 全角カナ [data=str;]
701-----------------------------------------------------------------------*/
702UtilTools.prototype.isZenkakuKana = function(data) {
703  var pettern = /^[\u30A0-\u30FF]+$/;
704  if(data.toString().match(pettern))
705    return true;
706  else
707    return false;
708}
709
710
711/*-----------------------------------------------------------------------
712- 数値 [data=str,int;]
713-----------------------------------------------------------------------*/
714UtilTools.prototype.isNum = function(data) {
715  var pettern = /^-?[0-9]+$/;
716  if(data.toString().match(pettern))
717    return true;
718  else
719    return false;
720}
721
722
723/*-----------------------------------------------------------------------
724- 少数(…XX.XX…の形式のみ) [data=str,int;]
725-----------------------------------------------------------------------*/
726UtilTools.prototype.isFew = function(data) {
727  var pettern = /^-?[0-9]+\.[0-9]+$/;
728  if(data.toString().match(pettern))
729    return true;
730  else
731    return false;
732}
733
734
735/*-----------------------------------------------------------------------
736- メールアドレス [data=str;]
737-----------------------------------------------------------------------*/
738UtilTools.prototype.isMailaddress = function(data) {
739  var pettern = /^[\w\.-]+@[\w\.-]+\.\w{2,}$/;
740  if(data.toString().match(pettern))
741    return true;
742  else
743    return false;
744}
745
746
747/*-----------------------------------------------------------------------
748- 電話番号(市外局番からと市外局番からでは「-」の位置が違うのでチェックは難しい) [data=str;]
749-----------------------------------------------------------------------*/
750UtilTools.prototype.isTel = function(data) {
751  var pettern = /^\d{1,4}-?\d{4}$|^\d{2,5}-?\d{1,4}-?\d{4}$/;
752  if(data.toString().match(pettern))
753    return true;
754  else
755    return false;
756}
757
758
759/*-----------------------------------------------------------------------
760- 携帯番号「0X0-XXXX-XXXX、0X0XXXXXXXX(11桁)」 [data=str;]
761-----------------------------------------------------------------------*/
762UtilTools.prototype.isMobile = function(data) {
763  var pettern = /^0\d0-\d{4}-\d{4}$|^0\d0\d{8}$/;
764  if(data.toString().match(pettern))
765    return true;
766  else
767    return false;
768}
769
770
771/*-----------------------------------------------------------------------
772- 日付「yyyy/mm/dd、yyyy-mm-dd、yyyymmdd」(うるう年対策済み) [data=str;]
773-----------------------------------------------------------------------*/
774UtilTools.prototype.isDatetime = function(data) {
775  if(data instanceof Date)
776    return true;
777
778  var pettern = /^(\d{4})(-|\/)?(0[1-9]|1[0-2])(-|\/)?(0[1-9]|[12][1-9]|[1-3]0|31)$/;
779  var matches = data.toString().match(pettern);
780
781  if(matches){
782    // 取得した日付をDate型に変換
783    var date = new Date(matches[1] +'/'+ matches[3] +'/'+ matches[5] );
784
785    // 桁埋めしてjavascriptのDateと正しいか比較
786    if(UtilTools.prototype.Ketaume(date.getFullYear(), 4) == matches[1] && UtilTools.prototype.Ketaume((date.getMonth() + 1), 2) == matches[3] && UtilTools.prototype.Ketaume(date.getDate(), 2) == matches[5])
787      return true;
788    else
789      return false;
790
791  }else{
792    return false;
793  }
794}
795
796
797/*-----------------------------------------------------------------------
798- 日付(年) [data=str,int;]
799-----------------------------------------------------------------------*/
800UtilTools.prototype.isYear = function(data) {
801  var pettern = /^\d{4}$/;
802  if(data.toString().match(pettern))
803    return true;
804  else
805    return false;
806}
807
808
809/*-----------------------------------------------------------------------
810- 日付(月) [data=str,int;]
811-----------------------------------------------------------------------*/
812UtilTools.prototype.isMonth = function(data) {
813  var pettern = /^(0[1-9]|1[0-2])$/;
814  if(data.toString().match(pettern))
815    return true;
816  else
817    return false;
818}
819
820
821/*-----------------------------------------------------------------------
822- 日付(日) [data=str,int;]
823-----------------------------------------------------------------------*/
824UtilTools.prototype.isDate = function(data) {
825  var pettern = /^(0[1-9]|[12][1-9]|[1-3]0|31)$/;
826  if(data.toString().match(pettern))
827    return true;
828  else
829    return false;
830}
831
832
833/*-----------------------------------------------------------------------
834- 時刻 [data=str;]
835-----------------------------------------------------------------------*/
836UtilTools.prototype.isTime = function(data) {
837  var pettern = /^([01]?[0-9]|2[0-3]):([0-5][0-9])$/;
838  if(data.toString().match(pettern))
839    return true;
840  else
841    return false;
842}
843
844
845/*-----------------------------------------------------------------------
846- 確認用項目(パスワード、アドレスの確認があっているか) [data=str; confirm=str;]
847-----------------------------------------------------------------------*/
848UtilTools.prototype.isMatchConfirm = function(data, confirm) {
849  if(data == confirm)
850    return true;
851  else
852    return false;
853}
854
855
856/*-----------------------------------------------------------------------
857- URL [data=str;]
858-----------------------------------------------------------------------*/
859UtilTools.prototype.isURL = function(data) {
860  var pettern = /^(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/;
861  if(data.toString().match(pettern))
862    return true;
863  else
864    return false;
865}
866
867
868/*-----------------------------------------------------------------------
869- 郵便番号「XXX-XXXX, XXXXXXX(7桁)」 [data=str,int;]
870-----------------------------------------------------------------------*/
871UtilTools.prototype.isZip = function(data) {
872  var pettern = /^\d{3}\-\d{4}$|^\d{7}$/;
873  if(data.toString().match(pettern))
874    return true;
875  else
876    return false;
877}
878
879
880/*-----------------------------------------------------------------------
881- クレジットカード(VISA, MasterCard, American Express のフォーマットに対応) [data=str,int;]
882-----------------------------------------------------------------------*/
883UtilTools.prototype.isCreditcard = function(data) {
884  var pettern = /^((4\d{3})|(5[1-5]\d{2})|(6011))([- ])?\d{4}([- ])?\d{4}([- ])?\d{4}|3[4,7]\d{13}$/;
885  if(data.toString().match(pettern))
886    return true;
887  else
888    return false;
889}
890
891
892/*-----------------------------------------------------------------------
893- null判定 [data=*;]
894-----------------------------------------------------------------------*/
895UtilTools.prototype.isNull = function(data) {
896  if(data == null)
897    return true;
898  else
899    return false;
900}
901
902
903/*-----------------------------------------------------------------------
904- undefined判定 [data=*;]
905-----------------------------------------------------------------------*/
906UtilTools.prototype.isUndefined = function(data) {
907  if(data == undefined)
908    return true;
909  else
910    return false;
911}
912
913
914/*-----------------------------------------------------------------------
915- 空, null, undefined判定 [data=*]
916-----------------------------------------------------------------------*/
917UtilTools.prototype.isEmpty = function(data) {
918  if(UtilTools.prototype.isNull(data) || UtilTools.prototype.isUndefined(data))
919    return true;
920  else if(data.toString().trim().length == 0)
921    return true;
922  else
923    return false;
924}
925
926
927/*-----------------------------------------------------------------------
928- isset [data=*]
929-----------------------------------------------------------------------*/
930UtilTools.prototype.isSet = function(data) {
931  return !UtilTools.prototype.isUndefined(data);
932}
933
934
935/*-----------------------------------------------------------------------
936- 文字数(上限以下か) [data=str,int; limit=int;]
937-----------------------------------------------------------------------*/
938UtilTools.prototype.isStringUpperLimit = function(data, limit) {
939  if(data.toString().trim().length <= limit)
940    return true;
941  else
942    return false;
943}
944
945
946/*-----------------------------------------------------------------------
947- 文字数(下限以上か) [data=str,int; limit=int;]
948-----------------------------------------------------------------------*/
949UtilTools.prototype.isStringLowerLimit = function(data, limit) {
950  if(data.toString().trim().length >= limit)
951    return true;
952  else
953    return false;
954}
955
956
957/*-----------------------------------------------------------------------
958- 機種依存文字 [data=-;]
959-----------------------------------------------------------------------*/
960UtilTools.prototype.isKishuizon = function(data) {
961  var pettern = /^$/;
962  if(data.toString().match(pettern))
963    return true;
964  else
965    return false;
966}
967
968
969/*-----------------------------------------------------------------------
970- 日付期間のチェック(開始~終了の間か) [data=str; start=str; end=str;]
971-----------------------------------------------------------------------*/
972UtilTools.prototype.isBetweenDatetime = function(data, start, end) {
973  // data, start, endがすべて日付形式でなければfalseを返す
974  if(!(UtilTools.prototype.isDatetime(data) && UtilTools.prototype.isDatetime(start) && UtilTools.prototype.isDatetime(end)))
975    return false;
976
977  var targetDate = new Date(data);
978  var startDate = new Date(start);
979  var endDate = new Date(end);
980
981  if(startDate.getTime() <= targetDate.getTime() && targetDate.getTime() <= endDate.getTime())
982    return true;
983  else
984    return false;
985}
986
987
988/*-----------------------------------------------------------------------
989- 数値範囲(200~500の間か) [data=str,int,float; start=str,int,float; end=str,int,float;]
990-----------------------------------------------------------------------*/
991UtilTools.prototype.isBetweenNum = function(data, start, end) {
992  // data, start, endがすべて数値でなければfalseを返す
993  var isNumData = UtilTools.prototype.isNum(data) || UtilTools.prototype.isFew(data);
994  var isNumStart = UtilTools.prototype.isNum(start) || UtilTools.prototype.isFew(start);
995  var isNumEnd = UtilTools.prototype.isNum(end) || UtilTools.prototype.isFew(end);
996
997  if(!(isNumData && isNumStart && isNumEnd))
998    return false;
999
1000  if(parseFloat(start) <= parseFloat(data) && parseFloat(data) <= parseFloat(end))
1001    return true;
1002  else
1003    return false;
1004}
1005
1006
1007/*-----------------------------------------------------------------------
1008- ページ判定 [data=str;]
1009-----------------------------------------------------------------------*/
1010UtilTools.prototype.isPage = function(data) {
1011  if(~location.pathname.toString().indexOf(data))
1012    return true;
1013  else
1014    return false;
1015}
1016
1017
1018/*-----------------------------------------------------------------------
1019- ページ判定(正規表現) [data=str;]
1020-----------------------------------------------------------------------*/
1021UtilTools.prototype.isPageRegex = function(data) {
1022  var pattern = UtilTools.prototype.StrToRegexPattern(data);
1023  if(location.pathname.toString().match(pattern))
1024    return true;
1025  else
1026    return false;
1027}
1028
1029
1030
1031
1032/*-----------------------------------------------------------------------
1033- テンプレ [data=-;]
1034-----------------------------------------------------------------------*/
1035UtilTools.prototype.is = function(data) {
1036  var pettern = /^$/;
1037  if(data.toString().match(pettern))
1038    return true;
1039  else
1040    return false;
1041}
1042
1043

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.