[펌] 삶에서 가장 좋은 것들

사는 얘기 2007. 11. 29. 10:14 Posted by galad
from 네이트 톡톡 - 백발마녀 님

사용자 삽입 이미지


1.Falling in love.
사랑에 빠지는 것.

2.Laughing so hard your face hurts.
얼굴이 아플 정도로 크게 웃기.

3.A hot shower.
따뜻한 샤워.

4.A special glance.
특별한 시선.

5.Getting mail.
편지를 받는 일.

6.Hearing your favorite song on the radio.
라디오에서 가장 좋아하는 노래를 듣는 일.

7.Lying in bed listening to the rain outside.
밖에 내리는 빗소리를 들으며 침대에 누워 있기.

8.Hot towels out of the dryer.
건조기에서 꺼낸 따뜻한 수건.

9.Finding the sweater you want is on sale for half price.
맘에 드는 스웨터가 반값에 팔리는 것을 알았을 때.

10.Chocolate milkshake.
초코 쉐이크.

11.A long distance phone call.
멀리서 온 전화.

12.A bubble bath.
거품 목욕.

13.Giggling.
낄낄대며 웃기.

14.A good conversation.
즐거운 대화.

15.The beach.
해변.

16.Laughing at yourself.
스스로에게 웃기.

17.Midnight phone calls that last for hours.
한밤중에 몇 시간씩 하는 통화.

18.Running through sprinklers.
스프링클러 사이를 뛰어 가기.

19.Laughing for absolutely no reason at all.
진짜 아무 이유 없이 웃기.

20.Having someone tell you that you're beautiful.
내가 아름답다고 말해주는 사람이 있다는 것.

21.Laughing at an inside joke.
농담의 속 뜻에 웃기.

22.Friends.
친구.

23.Waking up and realizing you still have a few hours left to sleep.
일어나보니 아직 몇 시간 더 잘 수 있다는 것을 알았을 때.

24.Making new friends or spending time with old ones.
새 친구를 사귀거나 오랜 친구와 함께 시간을 보내는 일.

25.Having someone play with your hair.
머리카락을 갖고 장난칠 사람이 있다는 것.

26.Sweet dreams.
좋은 꿈.

27.Song lyrics printed inside your new CD so you can sing along without feeling stupid.
새 CD 안에 노래 가사가 있어서 바보 같다는 생각 없이 노래를 따라 부를 수 있을 때.

28.Getting butterflies in your stomach every time you see that one person.
어떤 한 사람을 볼 때마다 안절부절 못하는 것.

29.Making eye contact with a cute stranger.
처음보는 깜찍한 사람과 시선을 맞추는 일.

30.Seeing smiles and hearing laughter from your friends.
친구들이 미소 짓는 것을 보고 웃음 소리를 들을 때.

31.Holding hands with someone you care about.
걱정 해주는 사람의 손을 잡아주는 일.

32.Running into an old friend and realizing that some things (good or bad) never change.
옛 친구를 우연히 만나서 (좋든지 나쁘든지) 하나도 변하지 않은 것을 발견했을 때.

33.Discovering that love is unconditional and stronger than time.
사랑은 무조건적이고 시간에 굴하지 않는다는 것을 알아냈을 때.

34.Hugging the person you love.
사랑하는 사람을 안아주는 일.

35.Watching the expression someone's face as they open much-desired present from you.
내가 준 정말 바라던 선물을 열어보는 사람의 모습을 바라보는 일.

36.Watching the sunrise.
일출 보기.

37.Getting out of bed every morning and thanking God for another beautiful day.
매일 아침 일어나서 새로운 아름다운 날이 시작된 것에 감사하기

어느 것이 젤 좋을까나???

'사는 얘기' 카테고리의 다른 글

One Hundred Pushups  (0) 2009.01.06
나도 어른인걸까  (0) 2007.12.04
[펌] ☆사랑을 위한 13가지 마음가짐☆  (0) 2007.11.27
친구.  (0) 2007.11.27
매직 존슨 'NBA 역사상 No.1 포인트가드'  (0) 2007.11.27

[펌] JExcelApi & POI

프로그래밍/Library 2007. 11. 28. 11:06 Posted by galad

JExcelApi(jxl.jar 다운로드)


http://www.andykhan.com/jexcelapi/index.html 에서 download JExcelApi에 가면
(http://www.andykhan.com/jexcelapi/download.html) tar.gz로 되어 있는데 압축풀면 jxl.jar있음


POI다운로드
http://jakarta.apache.org/poi/index.html /download/release


[엑셀파일읽기]

<%@ page language="java" %>
<%@ page contentType="text/html; charset=euc-kr"%>
<%@ page import="java.io.File,jxl.*"%>
<%


Workbook workbook = Workbook.getWorkbook(new File("E:/_Workspace/blr/blr/cms/excel/data/Book1.xls"));


Sheet sheet = workbook.getSheet(0);
Cell a1 = sheet.getCell(0,0);
Cell b2 = sheet.getCell(1,1);
Cell c3 = sheet.getCell(0,2);


String stringa1 = a1.getContents();
String stringb2 = b2.getContents();
String stringc3 = c3.getContents();


workbook.close();


%>


<%=stringa1%>
<%=stringb2%>
<%=stringc3%>


[엑셀파일로 저장]


<%@ page language="java" %>
<%@ page contentType="text/html; charset=euc-kr"%>
<%@ page import="java.io.File,java.util.Date,jxl.*,jxl.write.*"%>
<%
WritableWorkbook workbook = Workbook.createWorkbook(new File("E:/_Workspace/blr/blr/cms/excel/data/aaa.xls"));


WritableSheet sheet = workbook.createSheet("First Sheet", 0);
Label label = new Label(0,2,"A label record");
sheet.addCell(label);


// java.lang.Number 인지 jxl.write.Number  구분해야지^^


jxl.write.Number number = new jxl.write.Number(3,4,3.1415);
sheet.addCell(number);


workbook.write();
workbook.close();
%>


[POI로 테이블에 값넣기] poi.jsp참조


/***************************************************************************************/


엑셀파일처리 POI,JXL비교해 보았습니다.


10000번 for문을 돌려 첫번째 칼럼에 데이타를 입력하였습니다.


이걸 10번 반복한 체크시간입니다.




측정시간단위(밀리세컨)
D:\>java writeTest
============= jxl write time =============
0=>write time::719
1=>write time::281
2=>write time::250
3=>write time::266
4=>write time::234
5=>write time::266
6=>write time::234
7=>write time::266
8=>write time::234
9=>write time::329
=============      end      =============
============= poi write time =============
0=>write time::1110
1=>write time::922
2=>write time::1031
3=>write time::734
4=>write time::1328
5=>write time::766
6=>write time::797
7=>write time::1515
8=>write time::1719
9=>write time::2890
=============      end      =============



거의 2~3배 가까이 시간의 차이가 있더군여.. 단순히 엑셀파일만 다룬다면
jxl패키지를 사용하시는게 훨씬 좋을듯 합니다.

참조 : www.javapattern.info         www.okjsp.pe.kr


 자바 개발자라면 한번쯤은 Anti-MS를 외치면서,
무조건적으로 빌모씨 욕한번쯤은 해보았을 것이다.


허나 실상, 개발은 MS의 운영체제위에서 하고 있고,
이 창문이란게 없으면 넘 불편할 것도 같다.


특히, 고객은 모든 데이터를 Excel상에서 보고싶어 한다.


이런이유로 자바 개발자라고 해도, 이 엑셀을 잘 활용하여,
고객만족의 기쁨을 누려야 할 것이다.




자바로 엑셀을 핸들링 할 수 있는 방법은 크게 두가지로 나누어 진다.
1. Java Excel API   
    참조 : http://www.andykhan.com/jexcelapi/
2. POI
    참조 : http://jakarta.apache.org/poi/index.html




    흔히 POI를 엑셀을 핸들링 하기 위한 것으로만 오해하기 쉬운데,
    POI 프로젝트는 마이크로소프트 OLE 2 복합도큐먼트포맷형식의 파일을 순수 자바를 이용하여 핸들링하는 APIs로 구성되어있다.
    OLE 2 복합도큐먼트포맷형식의 파일은 마이크로소프트 엑셀 혹은 워드파일 등의 대부분의 오피스파일들을 나타낸다.




일반적으로 엑셀에 대한 핸들링만을 수행할 때에는 Jxl을 권장한다.
엑셀을 핸들링 할 때 엑셀에서 가장 작은 단위는 알고 있듯이 "셀"이다.
모든 작업은 이 셀을 중심으로 이루어진다.




주의할 점)
1) 엑셀 쉬트상에 "C15"라는 셀에 데이터가 있다고 가정하자.( 15행 C열을 나타낸다.)
이 때 Jxl에서는  A1( 1행 A열)부터  C15까지는 실제 데이터가 없을 경우에라도 null이 아닌 빈데이터가 있다고 인식한다.
즉 D열 이상이나, 16행 이상을 접근 할 때에 null로 인식한다.


하지만 POI에서는 C15 이내에 있다 하더라도 실제 데이터가 없을 때에는 null로 인식한다.


2) Jxl에서는 각 셀의 데이터 타입을 실제 엑셀 파일에서 지정된 셀의 타입을 따르고,
   POI에서는 셀의 실제 데이터 형을 따른다.
   예를 들어 특정 셀의 타입을 text 로 잡아놓고, 데이터를 1234로 입력하면
   Jxl에서는 "12345"로 인식하고, POI에서는 12345.00 이런식으로 인식한다.




EX ) Java Excel API를 이용한 Excel 읽기


import jxl.*;


// .. 중간생략


    Workbook workbook = null;
    Sheet sheet = null;
    Cell cell = null;


    try
    {
        //엑셀파일을 인식
        workbook = Workbook.getWorkbook( new File( szFileName));


        //엑셀파일에 포함된 sheet의 배열을 리턴한다.
        //workbook.getSheets();


        if( workbook != null)
        {
            //엑셀파일에서 첫번째 Sheet를 인식
            sheet = workbook.getSheet(0);


            if( sheet != null)
            {
                //셀인식 Cell a1 = sheet.getCell( 컬럼 Index, 열 Index);
                //셀 내용 String stringa1 = a1.getContents();


                //기록물철의 경우 실제 데이터가 시작되는 Row지정
                int nRowStartIndex = 5;
                //기록물철의 경우 실제 데이터가 끝 Row지정
                int nRowEndIndex   = sheet.getColumn( 2).length - 1;


                //기록물철의 경우 실제 데이터가 시작되는 Column지정
                int nColumnStartIndex = 2;
                //기록물철의 경우 실제 데이터가 끝나는 Column지정
                int nColumnEndIndex = sheet.getRow( 2).length - 1;


                String szValue = "";


                for( int nRow = nRowStartIndex; nRow <= nRowEndIndex; nRow++ )
                {
                    for( int nColumn = nColumnStartIndex; nColumn <= nColumnEndIndex ; nColumn++)
                    {
                        szValue = sheet.getCell( nColumn, nRow).getContents();


                        System.out.print( szValue);
                        System.out.print( "\t" );
                    }
                    System.out.println();
                }
            }
            else
            {
                System.out.println( "Sheet is null!!" );
            }
        }
        else
        {
            System.out.println( "WorkBook is null!!" );
        }
    }
    catch( Exception e)
    {
        e.printStackTrace();
    }
    finally
    {
        if( workbook != null)
        {
            workbook.close();
        }
    }


EX ) POI를 이용한 Excel 파일 읽기


import org.apache.poi.hssf.usermodel.*;


// .. 중간 생략


    HSSFWorkbook workbook = null;
    HSSFSheet sheet = null;
    HSSFRow row = null;
    HSSFCell cell = null;


    try
    {
        workbook = new HSSFWorkbook( new FileInputStream( new File( szFileName)));


        if( workbook != null)
        {
            sheet = workbook.getSheetAt( 0);


            if( sheet != null)
            {


                //기록물철의 경우 실제 데이터가 시작되는 Row지정
                int nRowStartIndex = 5;
                //기록물철의 경우 실제 데이터가 끝 Row지정
                int nRowEndIndex   = sheet.getLastRowNum();


                //기록물철의 경우 실제 데이터가 시작되는 Column지정
                int nColumnStartIndex = 2;
                //기록물철의 경우 실제 데이터가 끝나는 Column지정
                int nColumnEndIndex = sheet.getRow( 2).getLastCellNum();


                String szValue = "";


                for( int i = nRowStartIndex; i <= nRowEndIndex ; i++)
                {
                    row  = sheet.getRow( i);


                    for( int nColumn = nColumnStartIndex; nColumn <= nColumnEndIndex ; nColumn++)
                    {
                        cell = row.getCell(( short ) nColumn);
                       
                        if( cell == null)
                        {
                            continue;
                        }
                        if( cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC)
                        {
                            szValue = String.valueOf( cell.getNumericCellValue());
                        }
                        else
                        {
                            szValue = cell.getStringCellValue();
                        }


                        System.out.print( szValue);
                        System.out.print( "\t" );
                    }
                    System.out.println();
                }
            }
            else
            {
                System.out.println( "Sheet is null!!" );
            }
        }
        else
        {
            System.out.println( "WorkBook is null!!" );
        }


    }catch(Exception e){
        e.printStackTrace();
    }



EX ) Jxl을 이용하여 Excel에 데이터 저장하기


import jxl.*;


// .. 중간생략


    WritableWorkbook workbook = null;
 WritableSheet sheet = null;


 File excelFile = new File( szFileName);
 Label label = null;


 long start = 0;
   long end = 0;
   
    try
    {
        for(int i = 0 ; i < 10; i++)
        {
            workbook = Workbook.createWorkbook( excelFile);
            workbook.createSheet("sheet1", 0);
            sheet = workbook.getSheet(0);
            for( int j = 0; j < 10000; j++){
                label = new Label( j, 0, "test cell");
                sheet.addCell( label);
            }


            kidsbook.write();
            kidsbook.close();
        }
    }
    catch( Exception e)
    {
    }


// .. 중간생략



EX ) POI를 이용한 브라우저에서 Excel에 데이터 저장하여 보여주기


import org.apache.poi.hssf.usermodel.*;


// ... 생략


public void writeStream( PTSEvaluation[] arrPTSEvaluation) throws Exception
{
    try
    {


        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet sheet = wb.createSheet( "new sheet");
        HSSFRow row = null;
        HSSFCell cell = null;
        HSSFCellStyle style = null;


        ServletOutputStream excelOut = ServiceContext.getResponse().getOutputStream();
        ServiceContext.getResponse().setHeader( "Content-Disposition", "attachment;filename=EvaluationCompensationList.xls");
        ServiceContext.getResponse().setContentType( MimeType.getMimeType( "xls"));


        //로우 생성
        row = sheet.createRow( ( short)0);
        row.setHeightInPoints( 30);


        //셀에 적용한 스타일을 생성한다.
        style = PTSUtil.setExcelHeaderStyle( wb);


        // 셀 생성
        cell = row.createCell( (short)0);


        //한글 처리
        cell.setEncoding( HSSFCell.ENCODING_UTF_16); 


        //셀에 데이터 입력하기
        cell.setCellValue( "값");


        //셀에 스타일 적용하기
        cell.setCellStyle(style);


        //.. 중간생략 ( 이런 방식으로 로우와 셀을 증가 시키면서 작업을 수행하면 된다.


        wb.write( excelOut);
        excelOut.flush();
    }
    catch( Exception e)
    {
        e.printStackTrace();
        throw e;
    }
    finally
    {
        ServiceContext.getResponse().getOutputStream().close();
    }
}


// ... 생략

[펌] 각종 제어

프로그래밍/Library 2007. 11. 28. 11:04 Posted by galad

http://blog.naver.com/galad/140037028567

출처 블로그 > 맛깔나는 인생
원본 http://blog.naver.com/dltjdals8110/50003851272

 /**
  * コード類をフォーマット
  *
  * 与えられたサイズに足りない場合は空白を入れてフォーマットする
  * @param cd
  * @param size
  * @return
  */
 public static String cdFormat(String cd, int size) {
  String formatStr;
 
  if(cd == null || Constant.EMPTY_STR.equals(cd)){
   formatStr = cd;
  } else {
   for(int i = 0; i < size; i++){
    cd = cd + Constant.SPACE;
   }
   
   formatStr = cd.substring(0, size);
  }
 
  return formatStr;
 }
 
 /**
  *  文字列の後ろの半角スペースを削除する
  * 문자열의 뒤의 반각 스페이스를 삭제한다
  * @param str:文字列
  * @return 後ろの半角スペースを削除した文字列
  */
 public static String rTrim(String str) throws Exception{

  if(str != null && !Constant.EMPTY_STR.equals(str)){

   if(Constant.EMPTY_STR.equals(str.trim())){
    str = str.trim();
   } else {
    int len = str.length()-1;
   
    int i;
    for(i=0;;i++){
     if(str.charAt(len-i) != ' ') break;
    }
    str = str.substring(0,len-i+1);
   }
  }
 
 
  return str;
 }
 
 /**
  * nullチェック
  * @param str
  * @return bookean true:可 false:null
  * @throws Exception
  */
 public static boolean chkNull(String str) throws Exception{
 
  if(str == null || str.trim().equals(Constant.EMPTY_STR)){
   return false;
  }
 
  return true;
 }
 
 /**
  * 半角英数字チェック

  *반각영숫자 체크
  * @param myStr
  * @return boolean true:半角英数字あるいはnull false:半角英数字以外
  */
 public static boolean chkHanAlNum(String myStr) throws Exception{

     if(!chkNull(myStr)){
         return true;
     }
     myStr = myStr.trim();
  for (int i = 0; i < myStr.length(); i++) {

   char charData = myStr.charAt(i);
   if (((charData < 'A') || (charData > 'Z'))
     && ((charData < 'a') || (charData > 'z'))
     && ((charData < '0') || (charData > '9'))) {
    return false;
   }
  }
  return true;
 }
 
 
 /**
  * 半角チェック
  * @param str
  * @return boolean true:半角 false:全角
  * @throws Exception
  */
 public static boolean chkHankaku(String str) throws Exception{
    
     // nullだったら正常修了
     if(!chkNull(str)){
         return true;
     }
    
     byte[] bytes = str.getBytes();
        int beams = str.length();
        if (beams == bytes.length) {
            return true;
        } else {
            return false;
        }
 }
 
 /**
  * 半角カナを含ませない半角チェック

  *반각 가나를 포함하게하지 않는 반각 체크
  * @param str
  * @return boolean true:半角 false:全角あり、半角カナあり
  * @throws Exception
  */
 public static boolean chkHankakuNotHankana(String str) throws Exception{
    
     // nullだったら正常修了
     if(!chkNull(str)){
         return true;
     }
    
     // 半角カナが含まれていたら不可
     if(!chkHanKana(str)){
         return false;
     }
    
     // 半角チェック
     if(!chkHankaku(str)){
         return false;
     }
    
     return true;
 }
 
 
 
 /**
  * 入力数値のサイズチェック
  * 입력 수치의 사이즈 체크
  * 整数部と小数部のサイズが指定したとおりであるかチェックする
  * @param numInString
  * @param leftSize
  * @param rightSize
  * @return
  * @throws Exception
  */
 public static boolean chkNumSize(String numInString, int leftSize, int rightSize) throws Exception {
    
     if(numInString == null || Constant.EMPTY_STR.equals(numInString)){
         return true;
     }
    
     //数値解釈可能か?

    //수치 해석 가능한가
     try{
         Double.parseDouble(numInString);
     }catch(NumberFormatException e){
         return false;
     }
    
     //整数部、小数部の桁数は指定通りか?

    //정수부, 소수부의 자리수는 지정 대로인가?
     if(numInString.charAt(0) == '-'){
         numInString = numInString.substring(1);
     }
     String[] splited = numInString.split("\\.");
     if(splited[0].length() > leftSize){ //整数部
         return false;
     }
     // 小数部がなければ終了

    //소수부가 없으면 종료
     if(splited.length <= 1){
         return true;
     }
     if(splited[1].length() > rightSize){ //小数部
         return false;
     }
    
     return true;
 }

 /**
  * 半角数字チェック

  *반각 숫자 체크
  * @param strInString
  * @return 半角数字でなければfalseを返す
  */
    public static boolean chkNum(String strInString) throws Exception{
    
        if(!chkNull(strInString)){
         return true;
     }
        strInString = strInString.trim();
        //文字列の長さ分繰り返し
        int intChk;
        intChk = 0;
        for (int i = 0; i < strInString.length(); i++) {
            char c = strInString.charAt(i);

            if ((c < '0' && c != '.') || (c > '9' && c != '.') ) {
                return false;
            }
        }
       
       
        if (intChk == 0) {
            return true;
        } else {
            return false;
        }
    }
   
    /**
     * <PRE>
     * 半角数字(小数を含む)チェック

    *반각 숫자(소수를 포함한다) 체크
     * 空白文字を許容しない
     * @param decStr:半角数字(小数を含む)
     * @return 半角数字(小数を含む):true 半角数字以外:false
     * @throws Exception
     * </PRE>
     */
    public static boolean chkDecimal(String decStr) throws Exception{
 
        if(!chkNull(decStr)){
         return false;
     }
        for (int i = 0; i < decStr.length(); i++) {
            char c = decStr.charAt(i);

            if ((c < '0' && c != '.') || (c > '9' && c != '.') ) {
                return false;
            }
        }
       
        return true;

    }

 /**
  * <PRE>
  * 半角正の整数チェック

  * 반각정의 정수 체크
  * 空白文字を許容しない

  * 공백 문자를 허용 하지 않는다
  * @param intStr:半角正の整数
  * @return true:半角正の整数 false:半角正の整数
     * @throws Exception
     * </PRE>
  */
    public static boolean chkPositiveInt(String intStr) throws Exception{
    
        if(!chkNull(intStr)){
         return false;
     }
        for (int i = 0; i < intStr.length(); i++) {
            char c = intStr.charAt(i);

            if ((c < '0' ) || (c > '9') ) {
                return false;
            }
        }
       
        return true;
    }

    /**
  * 半角正の整数チェック

  *반각정의 정수 체크
  * @param strInString
  * @return 半角正の整数でなければfalseを返す
  */
    public static boolean chkPositiveInteger (String strInString) throws Exception{
    
        if(!chkNull(strInString)){
         return true;
     }
        strInString = strInString.trim();
        //文字列の長さ分繰り返し
        int intChk;
        intChk = 0;
        for (int i = 0; i < strInString.length(); i++) {
            char c = strInString.charAt(i);

            if ((c < '0' ) || (c > '9') ) {
                return false;
            }
        }
       
        if (intChk == 0) {
            return true;
        } else {
            return false;
        }
    }
   
    /**
     * 文字列からカンマ削除

     *문자열로부터 콤마 삭제
     * @param strNum
     * @return
     */
    public static String deleteComma(String strNum) throws Exception{

        //トークン格納用  토큰 격납용
        String strNextToken = Constant.EMPTY_STR;

        //戻り値格納用(編集後数値)  반환값 격납용(편집 후 수치)
        String strNewNum = Constant.EMPTY_STR;

        StringTokenizer tokenizer = new StringTokenizer(strNum, Constant.COMMA);

        //トークンが存在する間ループし変数にトークンを格納

       //토큰이 존재하는 동안 루프 해 변수에 토큰을 격납
        while (tokenizer.hasMoreTokens()) {
            strNextToken = tokenizer.nextToken();
            strNewNum += strNextToken;
        }

        return strNewNum;

    }

    /**
     * カンマをつける

     *콤마를 붙인다
     * @param strNum
     * @return
     */
    public static String numFormat(String strNum) throws Exception{

        //戻り値格納用(編集後数値)  반환값 격납용(편집 후 수치)
        String strNewNum = Constant.EMPTY_STR;

        //マイナスフラグ(-(マイナス)記号存在有無)

       //마이너스 플래그(-(마이너스) 기호 존재 유무)
        boolean blnMinus = false;

        // 文字列がnullだったら修了  문자열이 null라면 수료
        if (strNum == null || strNum.length() == 0) {
            strNewNum = null;
        } else {
            strNum = strNum.trim();
           
            if (strNum.substring(0, 1).equals(Constant.MINUS)) {
                strNum = strNum.substring(1, strNum.length());
                blnMinus = true;
            }

            //4桁目、7桁目、10桁目にカンマを挿入する

           //4자리수째, 7자리수째, 10 자리수째에 콤마를 삽입한다
            // int型なので10桁までを考えればよい

           //int형이므로 10 자리수까지를 생각하면 좋다
            for (int i = 0; i < strNum.length(); i++) {
                // ほかでは使用しないため例外的にマジックナンバー可

               //외에서는 사용하지 않기 때문에 예외적으로 magic number-가능
                if (((strNum.length() - i) == 4)
                        || ((strNum.length() - i) == 7)
                        || ((strNum.length() - i) == 10)) {
                    strNewNum += strNum.substring(i, i + 1) + Constant.COMMA;
                } else {
                    strNewNum += strNum.substring(i, i + 1);
                }
            }
        }

        //マイナス判定 마이너스 판정
        if (blnMinus == true) {
            return Constant.MINUS + strNewNum;
        } else {
            return strNewNum;
        }
    }
   
    /**
     * 文字列のバイト数チェック
     *
     * 指定したサイズより長ければfalse

     *지정한 사이즈보다 길면 false
     * @param str
     * @param byteSize バイト数
     * @return
     */
    public static boolean chkLength(String str, int byteSize) throws Exception{
       
        // 文字列がnullもしくは空文字の場合は正常終了

       //문자열이 null 혹은 공문자의 경우는 정상 종료
        if(str == null || Constant.EMPTY_STR.equals(str)){
            return true;
        }
       
        // 文字列のバイト数取得  문자열의 아르바이트수취득
        int len = str.getBytes("Windows-31J").length;
       
        // 文字列がサイズより長いかチェック  문자열이 사이즈보다 긴가 체크
        if(len > byteSize){
            return false;
        }
        return true;
    }
   
    /**
     * From,Toの相関チュック
     * From,To의 상관 체크
     * FromよりToのほうが大きな数値であればfalse

     *From보다 To 쪽이 큰 수치이면 false

     * @param from
     * @param to
     * @return
     */
    public static boolean chkFromTo(String from, String to) throws Exception{
       
        // 数値チェック  수치 체크
        if(!chkNum(from) || !chkNum(to)){
            // どちらかが数値でない  어느 쪽인지가 수치가 아니다
            return false;
        }
       
        // FROMとTOを数値に変換  FROM와 TO를 수치에 변환
        int nFrom = Integer.parseInt(from);
        int nTo = Integer.parseInt(to);
       
        // FromよりToが大きいのはfalse
        if(nFrom < nTo){
            return false;
        }
       
        return true;
    }

    /**
     * 半角カナチェック
     * 반각 가나 체크
     * 文字列に半角カナが含まれていればfalse

     *문자열에 반각 가나가 포함되어 있으면 false
     * @param str
     * @return
     */
    public static boolean chkHanKana(String str) throws Exception{
       
        if (str == null || str.length() == 0)
            return true;

        StringBuffer wkStr = new StringBuffer(str); // 変換バッファ
        for (int i = 0; i < wkStr.length(); i++) {

            // 半角カナ範囲(Unicode 0xFF61 ~ 0xFF9F)確認
            if (wkStr.charAt(i) >= 0xFF61 && wkStr.charAt(i) <= 0xFF9F) {
                return false;
            }
        }
        return true;
    }

   
    /**
     * コードテーブルからキーで該当するコードのリストを取得する

     *코드 테이블에서 키로 해당하는 코드의 리스트를 취득한다
     * @param key
     * @return
     * @throws Exception
     */
    public static List getCdBeans(String key) throws Exception {
        return _utilLogic.getCdBeans(key, false);
    }
   
    /**
     * コードテーブルからキーで該当するコードのリストを取得し、

     *코드 테이블에서 키로 해당하는 코드의 리스트를 취득해
     * その中から必要なコードのものだけのリストを取得する
     * 그 중에서 필요한 코드의 것만의 리스트를 취득한다
     * @param key
     * @param selectList
     * @return List
     * @throws Exception
     */
    public static List getCdBeansSelection(String key, List selectList) throws Exception {
       
        List resList = new ArrayList();
       
        // キーでコードのリスト取得   키로 코드의 리스트 취득
        List cdList = getCdBeans(key);
       
        for(int cdCnt = 0; cdCnt < cdList.size(); cdCnt++){
           
            CdBean bean = (CdBean)cdList.get(cdCnt);
           
            // リストの1番目(空白)は無条件に追加

           //리스트의 1번째 (공백)는 무조건 추가
            if(cdCnt == 0){
                resList.add(bean);
            }

            for(int selectCnt = 0; selectCnt < selectList.size(); selectCnt++){
               
                String selectCd = (String)selectList.get(selectCnt);
               
               
               
                // 選択したコードとテーブルから取得したコードが等しければリストに追加

               //선택한 코드와 테이블에서 취득한 코드가 동일하면 리스트에 추가
                if(bean.getValue().equals(selectCd)){
                   
                    resList.add(bean);
                }
               
            }
        }
       
        return resList;
    }
   
    /**
     * コードテーブルからキーで該当するコードのリストを取得する(not null 項目用)

     *코드 테이블에서 키로 해당하는 코드의 리스트를 취득한다(not null 항목용)
     * @param key
     * @return
     * @throws Exception
     */
    public static List getCdBeansNotNull(String key) throws Exception {
        return _utilLogic.getCdBeans(key, true);
    }
   
    /**
     * コードテーブルからキーで該当するコードのリストを取得し、

     *코드 테이블에서 키로 해당하는 코드의 리스트를 취득해,
     * その中から必要なコードのものだけのリストを取得する(not null 項目用)

     *그 중에서 필요한 코드의 것만의 리스트를 취득한다(not null 항목용)
     *
     * @param key
     * @param selectList
     * @return List
     * @throws Exception
     */
    public static List getCdBeansSelectionNotNull(String key, List selectList) throws Exception {
       
        List resList = new ArrayList();
       
        // キーでコードのリスト取得
        List cdList = getCdBeansNotNull(key);
       
        for(int cdCnt = 0; cdCnt < cdList.size(); cdCnt++){
           
            CdBean bean = (CdBean)cdList.get(cdCnt);

            for(int selectCnt = 0; selectCnt < selectList.size(); selectCnt++){
               
                String selectCd = (String)selectList.get(selectCnt);

                // 選択したコードとテーブルから取得したコードが等しければリストに追加

               //선택한 코드와 테이블에서 취득한 코드가 동일하면 리스트에 추가
                if(bean.getValue().equals(selectCd)){
                   
                    resList.add(bean);
                }
               
            }
        }
       
        return resList;
    }
   
    /**
     * 名称テーブルからキーで該当する名称のリストを取得する

     *명칭 테이블에서 키로 해당하는 명칭의 리스트를 취득한다
     * @param key
     * @return
     * @throws Exception
     */
    public static List getMeishoBeans(String key) throws Exception {
        return _utilLogic.getMeishoBeans(key, false);
    }
   
    /**
     * 名称テーブルからキーで該当する名称のリストを取得し、

     *명칭 테이블에서 키로 해당하는 명칭의 리스트를 취득해
     * その中から必要な名称のものだけのリストを取得する
     * 그 중에서 필요한 명칭의 것만의 리스트를 취득한다
     * @param key
     * @param selectList
     * @return List
     * @throws Exception
     */
    public static List getMeishoBeansSelection(String key, List selectList) throws Exception {
       
        List resList = new ArrayList();
       
        // キーで名称のリスト取得  키로 명칭의 리스트 취득
        List meiList = getMeishoBeans(key);
       
        for(int meiCnt = 0; meiCnt < meiList.size(); meiCnt++){
           
            CdBean bean = (CdBean)meiList.get(meiCnt);
           
            // リストの1番目(空白)は無条件に追加

           // 리스트의 1번째 (공백)는 무조건 추가
            if(meiCnt == 0){
                resList.add(bean);
            }

            for(int selectCnt = 0; selectCnt < selectList.size(); selectCnt++){
               
                String selectCd = (String)selectList.get(selectCnt);

                // 選択した名称とテーブルから取得した名称が等しければリストに追加

               //선택한 명칭과 테이블에서 취득한 명칭이 동일하면 리스트에 추가
                if(bean.getValue().equals(selectCd)){
                   
                    resList.add(bean);
                }
               
            }
        }
       
        return resList;
    }
   
    /**
     * 名称テーブルからキーで該当する名称のリストを取得する(not null 項目用)

     *명칭 테이블에서 키로 해당하는 명칭의 리스트를 취득한다(not null 항목용)
     * @param key
     * @return
     * @throws Exception
     */
    public static List getMeishoBeansNotNull(String key) throws Exception {
        return _utilLogic.getMeishoBeans(key, true);
    }
   
    /**
     * 名称テーブルからキーで該当する名称のリストを取得し、

     *명칭 테이블에서 키로 해당하는 명칭의 리스트를 취득해,
     * その中から必要な名称のものだけのリストを取得する(not null 項目用)
     * 그 중에서 필요한 명칭의 것만의 리스트를 취득한다(not null 항목용)
     * @param key
     * @param selectList
     * @return List
     * @throws Exception
     */
    public static List getMeishoBeansSelectionNotNull(String key, List selectList) throws Exception {
       
        List resList = new ArrayList();
       
        // キーで名称のリスト取得
        List meiList = getMeishoBeansNotNull(key);
       
        for(int meiCnt = 0; meiCnt < meiList.size(); meiCnt++){
           
            CdBean bean = (CdBean)meiList.get(meiCnt);
           

            for(int selectCnt = 0; selectCnt < selectList.size(); selectCnt++){
               
                String selectCd = (String)selectList.get(selectCnt);

                // 選択した名称とテーブルから取得した名称が等しければリストに追加

               //선택한 명칭과 테이블에서 취득한 명칭이 동일하면 리스트에 추가
                if(bean.getValue().equals(selectCd)){
                   
                    resList.add(bean);
                }
               
            }
        }
       
        return resList;
    }
   
    /**
     * SYSINFOテーブルから1レコード取得する

     *SYSINFO 테이블에서 1 레코드 취득한다
     * @return
     * @throws Exception
     */
    public static Sysinfo getSysinfo() throws Exception {
        return _utilLogic.getSysinfo();
    }

    /**
     * @param logic _utilLogic を設定。
     */
    public static void set_utilLogic(UtilLogic logic) {
        _utilLogic = logic;
    }
   


 /**
  * YYMMDDの文字列を受け取りCalendarを返す
  * YYMMDD의 문자열을 받아 Calendar를 돌려준다
  * @param myDate
  * @return
  * @throws Exception
  */
 private static Calendar getCalendar(String myDate) throws Exception{
    
        int intYear;
        int intMonth;
        int intDay;

        if (myDate.length() > 3) {
            intYear = java.lang.Integer.parseInt(myDate.substring(0, 4));
        } else {
            intYear = 0;
        }
        if (myDate.length() > 5) {
            intMonth = java.lang.Integer.parseInt(myDate.substring(4, 6));
        } else {
            intMonth = 0;
        }
        if (myDate.length() == 8) {
            intDay = java.lang.Integer.parseInt(myDate.substring(6, 8));
        } else {
            intDay = 0;
        }

        Calendar cal = new GregorianCalendar();
        cal.setLenient(false);
        cal.set(intYear, intMonth - 1, intDay);
       
        return cal;
 }
 
 
 /**
  * 日付妥当性チェック  일자 타당성 체크
  * @param myDate
  * @return
  */
 public static boolean chkDateFormat(String myDate) throws Exception{

     if(myDate == null || Constant.EMPTY_STR.equals(myDate)){
         return true;
     }
    
     // 文字列にスラッシュが入っていた場合消す

    // 문자열에 slash가 들어가 있었을 경우 지운다
     myDate = deleteSlash(myDate);
    
        //入力文字列が8桁以外の場合エラ-

       // 입력 문자열이 8자리수 이외의 경우 에러
     
        if (myDate.length() != 8) {
            return false;
        }

        for (int i = 0; i < myDate.length(); i++) {
            char charData = myDate.charAt(i);
            if ((charData < '0') || (charData > '9')) {
                return false;
            }
        }
 
        Calendar cal = new GregorianCalendar();
       
        cal = getCalendar(myDate);

        try {
            java.util.Date ud = cal.getTime();
        } catch (IllegalArgumentException iae) {
            return false;
        }

        return true;

    }
 
 /**
  * 日付の大小チェック
  * @param from
  * @param to
  * @return toがfromより大きければtrue そうでなければfalse
  * @throws Exception
  */
 public static boolean chkDateFromTo(String from, String to) throws Exception{
    
     // 文字列にスラッシュが入っていた場合消す

    //문자열에 slash가 들어가 있었을 경우 지운다
     from = deleteSlash(from);
     to = deleteSlash(to);
    
     // 日付のフォーマットが正しくなければ終了

    //일자의 포맷이 올바르지 않으면 종료
     if(!chkDateFormat(from) || !chkDateFormat(to)){
         return true;
     }
    
     // どちらかがnull なら終了
     if(from == null || Constant.EMPTY_STR.equals(from.trim())
             || to == null || Constant.EMPTY_STR.equals(to.trim())){
         return true;
     }
    
        Calendar calFrom = new GregorianCalendar();
        Calendar calTo = new GregorianCalendar();
       
        calFrom = getCalendar(from);
        calTo = getCalendar(to);
    
        // 比較
        return !calFrom.after(calTo);
 }
 
    /**
     * スラッシュをつける

     *slash를 붙인다
     * @param strNum
     * @return
     */
    public static String dateFormat(String strYmd) throws Exception{

        //戻り値格納用  반환값 격납용
        String strNewYmd = Constant.EMPTY_STR;

        // 文字列がnullだったら修了
        if (strYmd == null || strYmd.length() == 0) {
            strNewYmd = null;
        // 日付のフォーマットでなければnullを返して終了

       //일자의 포맷이 아니면 null를 돌려주어 종료
        } else if(!chkDateFormat(strYmd)){
            strNewYmd = null;
        } else {

            //3桁目、6桁目にスラッシュを挿入する
            strNewYmd =  strYmd.substring(0, 4) + Constant.SLASH + strYmd.substring(4, 6) +
                        Constant.SLASH + strYmd.substring(6, 8);

        }
        return strNewYmd;

    }

    /**
     * 文字列からスラッシュ削除  문자열로부터 slash 삭제
     * @param strNum
     * @return
     */
    public static String deleteSlash(String strDate) throws Exception{

        if(strDate == null){
            return null;
        }
       
        //トークン格納用  토큰 격납용
        String strNextToken = Constant.EMPTY_STR;

        //戻り値格納用  반환값 격납용
        String strNewNum = Constant.EMPTY_STR;

        StringTokenizer tokenizer = new StringTokenizer(strDate, Constant.SLASH);

        //トークンが存在する間ループし変数にトークンを格納

       //토큰이 존재하는 동안 루프 해 변수에 토큰을 격납
        while (tokenizer.hasMoreTokens()) {
            strNextToken = tokenizer.nextToken();
            strNewNum += strNextToken;
        }

        return strNewNum;

    }
   
    /**
     * 消費税を計算する

    *소비세를 계산한다
     * @param num
     * @return
     * @throws Exception
     */
    public static String taxCalc(String num) throws Exception{
       
        double tax;  // 消費税  소비세
        double amount; // 税込価格 세금 포함 가격
       
        if(num == null || Constant.EMPTY_STR.equals(num)){
            return null;
        }
       
        num = deleteComma(num);
       
        // 文字列が半角数字であるかチェック

       //문자렬이 반각 숫자일까 체크
        if(!chkNum(num)){
            return null;
        }

        // 消費税取得  소비세 취득
        Sysinfo sysinfo = _utilLogic.getSysinfo();
        tax = sysinfo.getTaxRate().doubleValue() / 100;
       
        amount = Integer.parseInt(num) * tax + Integer.parseInt(num);
       
        int i = (int)amount;
        return String.valueOf(i);
      
    }
   
   
   
    /**
     * 消費税計算をして表示用文言にフォーマットする

     *소비세 계산을 해 표시용 문언에 포맷 한다
     * @param num
     * @return
     * @throws Exception
     */
    public static String setTax(BigDecimal num) throws Exception{
     // 消費税計算  소비세 계산
        String taxStr = null;
       
        // 消費税計算とカンマづけを行う。소비세 계산과 콤마 지어를 실시한다.
        taxStr = Common.numFormat(Common.taxCalc(bigDecimalToStr(num)));
       
     // 結果nullでなければヘッダフッタを付加

    //결과 null가 아니면 헤더 footer를 부가
        if(taxStr != null){
            taxStr = Constant.TAX_HEADER + taxStr + Constant.TAX_FOOTER;
        }

     return taxStr;
       
    }

    /**
     * 消費税計算をして表示用文言にフォーマットする(引数String用)

     *소비세 계산을 해 표시용 문언에 포맷 한다(인수 String용)
     * @param num
     * @return
     * @throws Exception
     */
    public static String setTaxStr(String num) throws Exception{
     // 消費税計算
        String taxStr = null;
       
        // 消費税計算とカンマづけを行う。소비세 계산과 콤마 지어를 실시한다.
        taxStr = Common.numFormat(Common.taxCalc(num));
       
     // 結果nullでなければヘッダフッタを付加

     //결과 null가 아니면 헤더 footer를 부가
        if(chkNull(taxStr)){
            taxStr = Constant.TAX_HEADER + taxStr + Constant.TAX_FOOTER;
        } else {
            taxStr = Constant.EMPTY_STR;
        }

     return taxStr;
       
    }
   
    /**
     * BigDecimalをStringに変換する  (으)로 변환한다
     * @param num
     * @return
     */
    public static String bigDecimalToStr(BigDecimal num) throws Exception{
     
     if(num == null){
      return null;
     } else {
      return num.toString();
     }     
    }
   
 /**
  * 文字列型をBigdecimalに変換する 문자열형을 Bigdecimal로 변환한다
  * @param str
  * @return BigDecimal
  */
 public static BigDecimal strToBigDec(String str) throws Exception{
 
  if(str == null || Constant.EMPTY_STR.equals(str.trim()) ||
          !Common.chkNum(str)){
   return null;
  } else {
   
   return new BigDecimal(str);
  }
 
 }
 
 /**
  * StringをBigDecimal型に変換する
  * String를 BigDecimal형으로 변환한다
  * null, "", 数値以外の場合は0を返す
  * null, "", 수치 이외의 경우는 0을 돌려준다
  * @param str
  * @return
  * @throws Exception
  */
 public static BigDecimal strToBigDecNotNull(String str) throws Exception{
  if(str == null || Constant.EMPTY_STR.equals(str.trim()) ||
          !Common.chkNum(str)){
   return new BigDecimal(0);
  } else {
   
   return new BigDecimal(str);
  }
    
 }
 
 /**
  * 空文字だったらnullを返す  공문자라면 null를 돌려준다
  * @param String
  * @return String
  */
 public static String getEmptyOrStr(String str) throws Exception{
 
  if(str == null || Constant.EMPTY_STR.equals(str)){
   return null;
  } else{
   return str;
  }
 }
 
 /**
  * 空文字だったらnullを返す  공문자라면 null를 돌려준다
  * @param bigdecimal
  * @return String
  */
 public static BigDecimal getEmptyOrNumber(BigDecimal num) throws Exception{
 
  if(num == null || Constant.EMPTY_STR.equals(num)){
   return null;
  } else{
   return num;
  }
 }
 
 /**
  * 改行コードを<BR>に変換する

  *개행 코드를<BR>로 변환한다
  * @param str
  * @return
  */
 public static String replaceLF(String str){
    
     if(str == null || str.trim().equals(Constant.EMPTY_STR)){
         return null;
     }
    
     return str.replaceAll("\n", "<BR>");
 }
 
 /**
  * コード名を取得する
  * @param cdKey
  * @param cd
  * @return
  * @throws Exception
  */
 public static String getCdNm(String cdKey, String cd) throws Exception{
    
     CdTbl cdTbl = _utilLogic.getCdTbl(cdKey, cd);
    
     if(cdTbl == null){
         return null;
     } else {
         return cdTbl.getCdNm();
     }
 }
 
 /**
  * 名称名を取得する  명칭명을 취득한다
  * @param nmKbn
  * @param nmCd
  * @return
  * @throws Exception
  */
 public static String getMeishoNm(String nmKbn, String nmCd) throws Exception{
    
     Meisho meisho = _utilLogic.getMeisho(nmKbn, nmCd);
    
     if(meisho == null){
         return null;
     } else {
         return meisho.getName();
     }
 }
 
 /**
  * 全角チェック  전각 체크
  * 全角以外が入っていたらfalse 全部全角ならtrue

  *전각 이외가 들어가 있으면 false 전부 전각이라면 true
  * @param inStr
  * @return
  */
    public static boolean chkZenkaku(String inStr){
       
        if (inStr == null || inStr.length() == 0) {
            return true;
        }

        byte[] bytData;
        String strChar;
        boolean flgSingle = false;
        int intX;
        for (int i = 0; i < inStr.length(); i++) {
            try {
                strChar = inStr.substring(i, i + 1);
                bytData = strChar.getBytes("Windows-31J");
                for (int j = 0; j < bytData.length; j++) {
                    if (bytData[j] < 0) {
                        intX = 256 + bytData[j];

                    } else {
                        intX = bytData[j];
                    }
                }
                if (bytData.length == 2) {

                } else {
                    flgSingle = true;
                }
            } catch (Exception e) {
                flgSingle = false;
            }
        }

        if (flgSingle)
            return false;
        else
            return true;
    }

   
    /**
     * 検索上限チェック
     * 검색 상한 체크
     * システム限界数以上に設定していたらfalseを返す

     *시스템 한계수이상으로 설정해 있으면 false를 돌려준다
     * @param maxSize
     * @return true:システム上限内, null, 半角整数以外
     *    false:システム上限オーバー
     * @throws Exception
     */
    public static boolean chkMaxSearchNum(String maxSize) throws Exception{
      
       int maxNum;
       int sysMaxNum;
      
       if(!chkNull(maxSize)){
          
           return true;
       }
      
       // 半角数値チェック  반각 수치 체크
       if(!chkPositiveInteger(maxSize)){
          
           return true;
       }
      
       // システム的な最大件数  시스템적인 최대 건수
       sysMaxNum = Constant.SYS_MAS_SEARCH_NUMBER;
       // 入力された最大件数  입력된 최대 건수
       maxNum = Integer.parseInt(maxSize);
       // システム限界数より大きければfalse

      //시스템 한계수보다 크면 false
       if(maxNum > sysMaxNum){
           return false;
       }
       return true;
      
   }

    /**
     * 和暦チェック
     * 일본이 달력 체크
     * @param nengo 1:明治,2:大正,3:昭和,4:平成

     *1:메이지,2:타이쇼,3:쇼와,4:헤세이
     * @param date
     * @return
     * @throws Exception
     */
    public static boolean chkWaDate(String nengo, String date) throws Exception{
       
        boolean result = true;
       
        String nen;  // 年
        String tsuki;   // 月
        String niti;    // 日
        int intNen;
        int intTsuki;
        int intNiti;
        String seireki;  // 西暦
       
       
        // 桁数チェック(6バイトYYMMDD) 자리수 체크(6바이트 YYMMDD)
        if(date.length() != 6){
           
            return false;
        }
        // 数値チェック  수치 체크
        if(!chkPositiveInteger(date)){
           
            return false;
        }
        // 年、月、日を取得
        nen = date.substring(0, 2);
        tsuki = date.substring(2, 4);
        niti = date.substring(4, 6);
       
        // それぞれをintに変換 각각을 int에 변환
        intNen = Integer.parseInt(nen);
        intTsuki = Integer.parseInt(tsuki);
        intNiti = Integer.parseInt(niti);

        // 日付フォーマット通りの場合は各年号ごとに年月日をチェック

       //일자 포맷 그대로의 경우는 매년호 마다 연월일을 체크
        // 明治  메이지
        if(Constant.NENGO_MEIJI.equals(nengo)){
           
            // 45年を超える場合はありえない

           //45년을 넘는 경우는 있을 수 없다
            if(intNen > 45){
               
                return false;

            // 45年の場合は7月30日まで
            } else if(intNen == 45){
               
                if(intTsuki > 7){
                   
                    return false;
                } else if(intTsuki == 7){
                   
                    if(intNiti > 30){
                       
                        return false;
                    }
                   
                }
            // 1年の場合は9月8日から
            } else if(intNen == 1){
               
                if(intTsuki < 9){
                   
                    return false;
                } else if(intTsuki == 9){
                   
                    if(intNiti < 8){
                       
                        return false;
                    }
                }
            }
           
            // 西暦に変換
            seireki = String.valueOf(intNen + WAREKI_SA_MEIJI);
            seireki = seireki + tsuki + niti;
           
            if(!chkDateFormat(seireki)){
               
                return false;
            }
           
           
        // 大正
        } else if(Constant.NENGO_TAISHO.equals(nengo)){
           
            // 15年を超える場合はありえない
            if(intNen > 15){
               
                return false;
            // 15年の場合は12月25日まで
            } else if(intNen == 15){
               
                if(intTsuki > 12){
                   
                    return false;
                } else if(intTsuki == 12){
                   
                    if(intNiti > 25){
                        return false;
                    }
                }
            }
            // 1年の場合は7月30日から
            else if(intNen == 1){
               
                if(intTsuki < 7){
                    return false;
                } else if(intTsuki == 7){
                   
                    if(intNiti < 30){
                       
                        return false;
                    }
                }
            }
           
            // 西暦に変換
            seireki = String.valueOf(intNen + WAREKI_SA_TAISHO);
            seireki = seireki + tsuki + niti;
           
            if(!chkDateFormat(seireki)){
               
                return false;
            }
           
        // 昭和
        } else if(Constant.NENGO_SHOWA.equals(nengo)){
        
            // 64年の1月7日まで
            if(intNen > 67){
               
                return false;
            } else if(intNen == 64){
               
                if(intTsuki > 1){
                    return false;
                } else if(intTsuki == 1){
                   
                    if(intNiti > 7){
                        return false;
                    }
                }
            }
            // 1年は12月25日から
            if(intNen == 1){
               
                if(intTsuki < 12){
                   
                    return false;
                } else if(intTsuki == 12){
                   
                    if(intNiti < 25){
                        return false;
                    }
                }
            }
           
            // 西暦に変換
            seireki = String.valueOf(intNen + WAREKI_SA_SHOWA);
            seireki = seireki + tsuki + niti;
           
            if(!chkDateFormat(seireki)){
               
                return false;
            }
       
        // 平成
        } else if(Constant.NENGO_HEISEI.equals(nengo)){
           
            // 1年は1月8日から
            if(intNen == 1){
               
                if(intTsuki == 1){
                   
                    if(intNiti < 8){
                        return false;
                    }
                }
            }
           
            // 西暦に変換
            seireki = String.valueOf(intNen + WAREKI_SA_HEISEI);
            seireki = seireki + tsuki + niti;
           
            if(!chkDateFormat(seireki)){
               
                return false;
            }
        // それ以外の年号
        } else {
            return false;
        }
       
        // 現在日付よりも未来であればエラー
        if(!chkComparisonDate(seireki)){
            return false;
        }
       
       
        return result;
    }
   

   
    /**
     * 現在日付との比較
     * 현재 일자라는 비교
     * 現在日付よりも未来の日付であればfalseを返す

     *현재 일자보다 미래의 일자이면 false를 돌려준다
     * @param date
     * @return
     * @throws Exception
     */
    public static boolean chkComparisonDate(String date) throws Exception{
       
        String sysDateStr;
       
        // 日付妥当性チェック  일자 타당성 체크
        if(!chkDateFormat(date)){
           
            return false;
        }
       
        // 現在年月日取得
        Date sysDate = DateUtil.getSysdate();
     
        // SimpleDateFormatオブジェクトを生成

       //SimpleDateFormat 오브젝트를 생성
        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
        sysDateStr = formatter.format(sysDate);
       
        // 日付の相関チェック呼び出し  일자의 상관 체크 호출
        if(!chkDateFromTo(date, sysDateStr)){
            return false;
        }
       
        return true;
    }

 /**
  * 日付妥当性チェック(YYYYMMの場合)

   *일자 타당성 체크(YYYYMM의 경우)
  * @param myDate
  * @return
  */
 public static boolean chkDateFormatYYYYMM(String myDate) throws Exception{

     String nen;
     String tuki;
     int intNen;
     int intTuki;
    
    
     if(myDate == null || Constant.EMPTY_STR.equals(myDate)){
         return true;
     }
    
     // 文字列にスラッシュが入っていた場合消す

     //문자열에 slash가 들어가 있었을 경우 지운다
     myDate = deleteSlash(myDate);
    
        //入力文字列が6桁以外の場合エラ-

       //입력 문자열이 6자리수 이외의 경우 에러
        if (myDate.length() != 6) {
            return false;
        }

        // 数字のみで構成されているかチェック

       //숫자만으로 구성되어 있을까 체크
        for (int i = 0; i < myDate.length(); i++) {
            char charData = myDate.charAt(i);
            if ((charData < '0') || (charData > '9')) {
                return false;
            }
        }
 
        // 年、月部分を取り出し  해, 달부분을 꺼내
        nen = myDate.substring(0,4);
        tuki = myDate.substring(4, 6);
       
        // 月部分をintに変換し、1から12の間であるかチェック

        //달부분을 int로 변환해, 1에서 12의 사이일까 체크
        intTuki = Integer.parseInt(tuki);
        if(intTuki < 1 || intTuki > 12){
           
            return false;
        }

        return true;

    }
 
 /**
  * 日付の大小チェック(YYYYMMの場合) 일자의 대소 체크(YYYYMM의 경우)
  * @param from
  * @param to
  * @return toがfromより大きければtrue そうでなければfalse 同じ場合はtrue
  * @throws Exception
  */
 public static boolean chkDateFromToYYYYMM(String from, String to) throws Exception{
    
     int intFrom;
     int intTo;
    
     // 文字列にスラッシュが入っていた場合消す

    //문자열에 slash가 들어가 있었을 경우 지운다
     from = deleteSlash(from);
     to = deleteSlash(to);
    
     // 日付のフォーマットが正しくなければ終了

    //일자의 포맷이 올바르지 않으면 종료
     if(!chkDateFormatYYYYMM(from) || !chkDateFormatYYYYMM(to)){
         return true;
     }
    
     // どちらかがnull なら終了
     if(!chkNull(from) || !chkNull(to)){
         return true;
     }
    
    
        // 年、月部分を取り出し  해, 달부분을 꺼내
     intFrom = Integer.parseInt(from);
     intTo = Integer.parseInt(to);
       
     // toよりfromのほうが先であればfalse

    //to보다 from 쪽이 앞이면 false
     if(intFrom > intTo){
         return false;
     }
       
     return true;
 }
 
    /**
     * スラッシュをつけるYYYYMM  slash를 붙이는 YYYYMM
     * @param strNum
     * @return
     */
    public static String dateFormatYYYYMM(String strYmd) throws Exception{

        //戻り値格納用  반환값 격납용
        String strNewYmd = Constant.EMPTY_STR;

        // 文字列がnullだったら終了
        if (strYmd == null || strYmd.length() == 0) {
            strNewYmd = null;
        // 日付のフォーマットでなければnullを返して終了

       //일자의 포맷이 아니면 null를 돌려주어 종료
        } else if(!chkDateFormatYYYYMM(strYmd)){
            strNewYmd = null;
        } else {

            //3桁目、6桁目にスラッシュを挿入する
            strNewYmd =  strYmd.substring(0, 4) + Constant.SLASH + strYmd.substring(4, 6);
//            //3桁目、6桁目にスラッシュを挿入する
//            strNewYmd =  strYmd.substring(0, 4) + Constant.SLASH + strYmd.substring(4, 6) +
//                        Constant.SLASH + strYmd.substring(6, 8);

        }
        return strNewYmd;

    }
   
   
    /**
     * application.propertiesのメッセージをキーにより取得する

     *application.properties의 메세지를 키에 의해 취득한다
     * @param key メッセージのキー
     * @return String メッセージ
     * @throws Exception
     */
    public static String getMessage(String key) throws Exception {
       
        ResourceBundle bundle = ResourceBundle.getBundle(Constant.MESSAGE_FILE_NAME);
        return bundle.getString(key);
    }
   
    /**
     * 文字列From,Toを比較する  문자열 From,To를 비교한다
     *
     * 辞書順で比較し、FromがToより大きければfalse

     *사전순서로 비교해, From가 To보다 크면 false
     * 同じ、もしくはFrom < To ならばtrue
     * @param from
     * @param to
     * @return
     * @throws Exception
     */
 public static boolean chkCdFromTo(String from, String to) throws Exception{
    
     // どちらかがnullだったらtrueで強制終了

    //어느 쪽인지가 null라면 true로 강제 종료
     if(!Common.chkNull(from) || !Common.chkNull(to)){
         return true;
     }
    
     // from > toだったらfalse
     if(0 < from.trim().compareTo(to.trim())) {
         return false;
     }
     return true;
    
 }
 
 
 
 /**
  * 整数チェック  정수 체크
  * @param iStr
  * @return true:正の整数,負の整数 false:整数以外

  *정의 정수, 부의 정수 false:정수 이외
  * @throws Exception
  */
 public static boolean chkInt(String iStr) throws Exception{
 
  if(!Common.chkNull(iStr)){
         return false;
     }

  if(iStr.indexOf(Constant.MINUS) != 0) return Common.chkPositiveInt(iStr.substring(0));
 
  return Common.chkPositiveInt(iStr.substring(1));
 
 
 }

일본어로 프로젝트를 진행하시는 분들은 참고하세여.
일본어가 들어 있는 스트링이 전각으로 되어 있는지 반각으로 되어 있는지 확인합니다.

참고) 아래의 메소드는 static으로 되어 있습니다.
      필요에 따라 바꿔서 사용하세여.
      이원영님께서 만드신 JDF에도 반영시켜도 좋을 듯 싶군여~ ㅋㅋ

(소스)----------------------------------------------------------------------------
    /**
     * 대상문자열(strTarget)이 전각문자로 구성되어 있는지 확인한다.
     *
     * @param strTarget 전각여부를 확인할 문자열
     * @return 전각문자만으로 구성된 문자열일 경우 true반환. 아니면 false
     */
    public static boolean isFullWord(String strTarget)
{ byte[] byteArray = null; byteArray = strTarget.getBytes();
for(int i = 0; i < byteArray.length; i++)
{ if((byteArray[i] >= (byte)0x81 && byteArray[i] <= (byte)0x9f) || (byteArray[i] >= (byte)0xe0 && byteArray[i] <= (byte)0xef))
{ if((byteArray[i+1] >= (byte)0x40 && byteArray[i+1] <= (byte)0x7e) || (byteArray[i+1] >= (byte)0x80 && byteArray[i+1] <= (byte)0xfc))
{ i++; }
else
{ return false; } }
else
{ return false; } }
return true; } /** * 대상문자열(strTarget)이 반각문자로 구성되어 있는지 확인한다. * * @param strTarget 반각여부를 확인할 문자열 * @return 반각문자만으로 구성된 문자열일 경우 true반환. 아니면 false */ public static boolean isHalfWord(String strTarget)
{ byte[] byteArray = null; byteArray = strTarget.getBytes();
for(int i = 0; i < byteArray.length; i++)
{ if((byteArray[i] >= (byte)0x81 && byteArray[i] <= (byte)0x9f) || (byteArray[i] >= (byte)0xe0 && byteArray[i] <= (byte)0xef))
{ if((byteArray[i+1] >= (byte)0x40 && byteArray[i+1] <= (byte)0x7e) || (byteArray[i+1] >= (byte)0x80 && byteArray[i+1] <= (byte)0xfc))
{ return false; } } }
return true; } 소프트웨어 기술의 강국! 우리나라 만세~ ^^
 
출처: http://www.javaservice.net/~java/bbs/read.cgi?m=resource&b=javatip&c=r_p&n=1016839954&k=전각&d=tb#1016839954

'프로그래밍 > Library' 카테고리의 다른 글

[펌] 자바로 엑셀 때려잡기!!  (0) 2007.11.28
[펌] 각종 제어  (0) 2007.11.28
[펌] 반각문자를 전각문자로  (0) 2007.11.28
[펌] 전각/반각 체크  (0) 2007.11.28
PDF 파일 만들기 - fop 0.93  (0) 2007.11.28

스크립트로 하는 것이라면..


//반각문자를 전각문자로
function convert2ByteChar(x_char) {
 var x_2byteChar = "";
 var c = x_char.charCodeAt(0);
 if ( 32 <= c && c <= 126 ) {
  if (c == 32) {
   x_2byteChar = unescape("%uFFFC");
  } else {
   x_2byteChar = unescape("%u"+gf_DecToHex(c+65248));
  }
 }
 return x_2byteChar;
}

[펌] 전각/반각 체크

프로그래밍/Library 2007. 11. 28. 11:02 Posted by galad

일본어에는 전각/반각이라는 것이 있다. 전각은 한문자를 표현하는데 2바이트를 사용하는 것, 반각은 영문자와 같이 1바이트를 사용하는 것. 업무시스템 수정사항중 전각/반각입력을 못하게해야되는 요구사항이 생겼다. 자바스크립트로 해결할 요량으로 구글링.


<SCRIPT LANGUAGE="javascript">

/** * 全角であるかをチェックします。 * * @param チェックする値 * @return ture : 全角 / flase : 全角以外 */

function checkIsZenkaku(value)
{
  for (var i = 0; i < value.length; ++i)

  {

    var c = value.charCodeAt(i);

    // 半角カタカナは不許可

    if (c < 256 || (c >= 0xff61 && c <= 0xff9f))

    {

      return false;

    }

  }

  return true;

}

 

function check()

{

  if (checkIsZenkaku(document.f.txt.value))

  {

    alert("指定の文字全ては全角です");

  }

  else

  {

    alert("指定の文字に全角以外の文字が含まれています");

  }

}

</SCRIPT>

 

or

 

<script language="javascript">

<!--//

/** JavaScript 入力文字列内に全角文字が含まれていたら警告する **/

function Check()

{  

  var str = document.frmForm.txtText.value;  

  for(i=0;i<str.length;i++)  

  {   

    if(escape(str.charAt(i)).length>=4)   

    {    

      alert("全角文字が含まれています");    

      document.frmForm.txtText.value = "";    

      return;   

    }  

  }  

  alert("全角文字は含まれていません");

}

//-->

</script>

 

 

 

이런 소스를 적용해보았다.
뭐..잘 동작하나, 업무시스템과 클라이언트가 전부 IE란 점을 착안. IME를 불가능하도록 하는 방법으로 간단히 해결.

<INPUT TYPE = text STYLE = "ime-mode:disabled" >