人民币转换可以写脚本,如: <% '****人民币大小写转换格式**** dim str(9) str(0)="零" str(1)="壹" str(2)="贰" str(3)="叁" str(4)="肆" str(5)="伍" str(6)="陆" str(7)="柒" str(8)="捌" str(9)="玖" aa=Request.form("source") hh=formatnumber(aa,2,-1) aa=replace(hh,".","") aa=replace(aa,",","") for i=1 to len(aa) s=mid(aa,i,1) mynum=str(s) select case(len(aa)+1-i) case 1: k= mynum&"分" case 2: k= mynum&"角" case 3: k= mynum&"元" case 4: k= mynum&"拾" case 5: k= mynum&"佰" case 6: k= mynum&"仟" case 7: k= mynum&"万" case 8: k= mynum&"拾" case 9: k= mynum&"佰" case 10: k= mynum&"仟" end select m=m&k next %> <html> <head> <title>数字转换</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <!-- Elseif(s=".") then n=m i=i+2 for j=i to len(aa) s=mid(aa,i,1) mynum=str(s) select case(len(aa)+1-i) case 1: p= mynum&"分" case 2: p= mynum&"角" end select m=m&p next --><body bgcolor="#FFFFFF"> <form method="post" name="forma"> <input type="text" name="source" value="<%=hh%>"> = <input type="text" name="result" value="<%=m%>" size="40"><input type="submit" name="Submit" value="提交 " > </form> </body> </html>也可以写在CODE BEHIND里,比如说: '将货币的小写转换为大写,例如:肆佰陆拾贰圆捌角柒分Public Function Num2Chi(ByVal txtJE As Double) As String Dim i, K As Integer Dim NC, nd, ka, chrNum, strZheng As String Dim c1, c2, c3 As String Dim K1 As Integer Dim Zheng As String Dim Xiao As String NC = Trim(Format(txtJE, "##0.00")) c1 = "仟佰拾万仟佰拾亿仟佰拾万仟佰拾元" c2 = "角分" c3 = "玖捌柒陆伍肆叁贰壹" If NC = 0 Then Num2Chi = "零元整" Exit Function End If Num2Chi = "" Zheng = Mid(NC, 1, (Len(NC) - 3)) Xiao = Mid(NC, (Len(Zheng) + 2)) If Val(Xiao) <> 0 Then For i = Len(Xiao) To 1 Step -1 chrNum = Mid(Xiao, i, 1) If chrNum <> 0 Then Num2Chi = Mid(c2, i, 1) & Num2Chi Num2Chi = Mid(c3, (Len(c3) - chrNum + 1), 1) & Num2Chi End If Next i End If K = 0 If Val(Zheng) <> 0 Then Num2Chi = "元" & Num2Chi For i = Len(Zheng) To 1 Step -1 If (Len(Zheng) - i) = 4 Then Num2Chi = "万" & Num2Chi ElseIf (Len(Zheng) - i) = 8 Then Num2Chi = "亿" & Num2Chi ElseIf (Len(Zheng) - i) = 12 Then Num2Chi = "万" & Num2Chi End If chrNum = Mid(Zheng, i, 1) If chrNum <> 0 Then If i = Len(Zheng) Then Num2Chi = Mid(c3, (Len(c3) - chrNum + 1), 1) & Num2Chi Else If (Len(Zheng) - i) <> 4 And (Len(Zheng) - i) <> 8 And (Len(Zheng) - i) <> 12 Then Num2Chi = Mid(c1, (Len(c1) - K), 1) & Num2Chi End If Num2Chi = Mid(c3, (Len(c3) - chrNum + 1), 1) & Num2Chi End If Else If Mid(Num2Chi, 1, 1) <> "元" And Mid(Num2Chi, 1, 1) <> "万" And Mid(Num2Chi, 1, 1) <> "亿" Then If Mid(Num2Chi, 1, 1) <> "零" Then Num2Chi = "零" & Num2Chi End If End If End If K = K + 1 Next i End If If Right(Trim(Num2Chi), 1) <> "分" Then Num2Chi = Num2Chi & "整" End If End Function
private static string[] cstr={"零","壹","贰","叁","肆", "伍", "陆","柒","捌","玖"};
private static string[] wstr={"","","拾","佰","仟","萬","拾","佰","仟","億","拾","佰","仟"};
//数字必须在12位整数以内的字符串
//调用方式如:Label1.Text=ConvertInt("数字字符串");public string ConvertInt(string str)
{
int len=str.Length;
int i;
string tmpstr,rstr;
rstr="";
for(i=1;i<=len;i++)
{
tmpstr=str.Substring(len-i,1);
rstr=string.Concat(cstr[Int32.Parse(tmpstr)]+wstr[i],rstr);
}
rstr=rstr.Replace("拾零","拾");
rstr=rstr.Replace("零拾","零");
rstr=rstr.Replace("零佰","零");
rstr=rstr.Replace("零仟","零");
rstr=rstr.Replace("零萬","萬");
for(i=1;i<=6;i++)
rstr=rstr.Replace("零零","零");
rstr=rstr.Replace("零萬","零");
rstr=rstr.Replace("零億","億");
rstr=rstr.Replace("零零","零");
rstr+="圆整";
return rstr;
}
<%
'****人民币大小写转换格式****
dim str(9)
str(0)="零"
str(1)="壹"
str(2)="贰"
str(3)="叁"
str(4)="肆"
str(5)="伍"
str(6)="陆"
str(7)="柒"
str(8)="捌"
str(9)="玖"
aa=Request.form("source")
hh=formatnumber(aa,2,-1)
aa=replace(hh,".","")
aa=replace(aa,",","")
for i=1 to len(aa)
s=mid(aa,i,1)
mynum=str(s)
select case(len(aa)+1-i)
case 1: k= mynum&"分"
case 2: k= mynum&"角"
case 3: k= mynum&"元"
case 4: k= mynum&"拾"
case 5: k= mynum&"佰"
case 6: k= mynum&"仟"
case 7: k= mynum&"万"
case 8: k= mynum&"拾"
case 9: k= mynum&"佰"
case 10: k= mynum&"仟"
end select
m=m&k
next
%>
<html>
<head>
<title>数字转换</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<!--
Elseif(s=".") then
n=m
i=i+2
for j=i to len(aa)
s=mid(aa,i,1)
mynum=str(s)
select case(len(aa)+1-i)
case 1: p= mynum&"分"
case 2: p= mynum&"角"
end select
m=m&p
next
--><body bgcolor="#FFFFFF">
<form method="post" name="forma">
<input type="text" name="source" value="<%=hh%>">
=
<input type="text" name="result" value="<%=m%>" size="40"><input type="submit" name="Submit" value="提交 " >
</form>
</body>
</html>也可以写在CODE BEHIND里,比如说:
'将货币的小写转换为大写,例如:肆佰陆拾贰圆捌角柒分Public Function Num2Chi(ByVal txtJE As Double) As String
Dim i, K As Integer
Dim NC, nd, ka, chrNum, strZheng As String
Dim c1, c2, c3 As String
Dim K1 As Integer
Dim Zheng As String
Dim Xiao As String
NC = Trim(Format(txtJE, "##0.00"))
c1 = "仟佰拾万仟佰拾亿仟佰拾万仟佰拾元"
c2 = "角分"
c3 = "玖捌柒陆伍肆叁贰壹"
If NC = 0 Then
Num2Chi = "零元整"
Exit Function
End If
Num2Chi = ""
Zheng = Mid(NC, 1, (Len(NC) - 3))
Xiao = Mid(NC, (Len(Zheng) + 2))
If Val(Xiao) <> 0 Then
For i = Len(Xiao) To 1 Step -1
chrNum = Mid(Xiao, i, 1)
If chrNum <> 0 Then
Num2Chi = Mid(c2, i, 1) & Num2Chi
Num2Chi = Mid(c3, (Len(c3) - chrNum + 1), 1) & Num2Chi
End If
Next i
End If K = 0
If Val(Zheng) <> 0 Then
Num2Chi = "元" & Num2Chi
For i = Len(Zheng) To 1 Step -1
If (Len(Zheng) - i) = 4 Then
Num2Chi = "万" & Num2Chi
ElseIf (Len(Zheng) - i) = 8 Then
Num2Chi = "亿" & Num2Chi
ElseIf (Len(Zheng) - i) = 12 Then
Num2Chi = "万" & Num2Chi
End If chrNum = Mid(Zheng, i, 1)
If chrNum <> 0 Then
If i = Len(Zheng) Then
Num2Chi = Mid(c3, (Len(c3) - chrNum + 1), 1) & Num2Chi
Else
If (Len(Zheng) - i) <> 4 And (Len(Zheng) - i) <> 8 And (Len(Zheng) - i) <> 12 Then
Num2Chi = Mid(c1, (Len(c1) - K), 1) & Num2Chi
End If
Num2Chi = Mid(c3, (Len(c3) - chrNum + 1), 1) & Num2Chi
End If
Else
If Mid(Num2Chi, 1, 1) <> "元" And Mid(Num2Chi, 1, 1) <> "万" And Mid(Num2Chi, 1, 1) <> "亿" Then
If Mid(Num2Chi, 1, 1) <> "零" Then
Num2Chi = "零" & Num2Chi
End If
End If
End If
K = K + 1
Next i
End If
If Right(Trim(Num2Chi), 1) <> "分" Then
Num2Chi = Num2Chi & "整"
End If
End Function