<%
amt = "500,000,000"
Dim unit1(10)
Dim unit2(2)
Dim unit3(2)
unit1(0) = ""
unit1(1) = "일"
unit1(2) = "이"
unit1(3) = "삼"
unit1(4) = "사"
unit1(5) = "오"
unit1(6) = "육"
unit1(7) = "칠"
unit1(8) = "팔"
unit1(9) = "구"
unit2(0) = "십"
unit2(1) = "백"
unit2(2) = "천"
unit3(0) = "만"
unit3(1) = "억"
unit3(2) = "조"
vamt = Replace(amt, ",", "")
xchk = IsNumeric(vamt)
If xchk = True Then
total = Len(CStr(CDbl(amt)))
vamt = CDbl(amt)
rs = ""
For i = 1 To total
num = Mid(vamt, i, 1)
temp1 = (total - i) + 1
rs = rs & unit1(num)
If num <> 0 And i <> total Then
If Len(Left(vamt, (total - i) + 1)) Mod 4 = 0 Then rs = rs & unit2(2)
If Len(Left(vamt, (total - i) + 1)) Mod 4 = 3 Then rs = rs & unit2(1)
If Len(Left(vamt, (total - i) + 1)) Mod 4 = 2 Then rs = rs & unit2(0)
End If
If temp1 = 5 And Right(rs, 1) <> unit3(2) And Right(rs, 1) <> unit3(1) Then rs = rs & unit3(0)
If temp1 = 9 And Right(rs, 1) <> unit3(2) Then rs = rs & unit3(1)
If temp1 = 13 Then rs = rs & unit3(2)
Next
rs = rs & "원"
'msgbox
response.write "input : " & amt & vbCr & "output : " & rs
Else
'unloadrpt "금액을 확인해주세요"
response.write "금액을 확인해주세요"
End If
%>
'ASP*' 카테고리의 다른 글
모든 Request값 자동으로 저장 (0) | 2010.11.01 |
---|---|
ASP SQL Injection & XSS Injection 방지 (0) | 2010.10.28 |
레코드셋(RecordSet, rs) 이동 명령 (0) | 2009.04.23 |
Checkbox 배열 값 보내기 (0) | 2009.01.14 |
자릿수 맞추는 방법 (0) | 2009.01.14 |