diff --git a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java index b9f4e370..d0113515 100644 --- a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java @@ -287,4 +287,34 @@ public class CmmnUtil { DecimalFormat decFormat = new DecimalFormat("###,###"); return decFormat.format(number); } + + /** 숫자를 한글로 표시한다. + * @param number + * @return + */ + public static String convertNumberToHangul(String number) { + String[] han1 = { "", "일", "이", "삼", "사", "오", "육", "칠", "팔", "구" }; + String[] han2 = { "", "십", "백", "천" }; + String[] han3 = { "", "만", "억", "조", "경" }; + String result = ""; + int len = number.length(); + int nowInt = 0; + boolean hasHan3 = false; + for (int i = len; i > 0; i--) { + nowInt = Integer.parseInt(number.substring(len - i, len - i + 1)); + int han2Pick = (i - 1) % 4; + if (nowInt > 0) { + result += (han1[nowInt]) + (han2[han2Pick]); + if (han2Pick > 0) { + hasHan3 = false; + } + } + if (!hasHan3 && han2Pick == 0) { + result += (han3[(i - 1) / 4]); + hasHan3 = true; + } + } + return result.toString(); + } + }