欢迎光临
我们一直在努力

将数字转换成大写的金额换算函数-ASP教程,ASP应用

建站超值云服务器,限时71元/月

<%

function rmb(num)

num = formatnumber(num, 2)

dim numlist

dim rmblist

dim numlen

dim numchar

dim numstr

dim n

dim n1, n2

dim hz

numlist = "零壹贰叁肆伍陆柒捌玖"

rmblist = "分角元拾佰仟万拾佰仟亿拾佰仟万"

if num > 9999999999999.99 then

rmb = "超出范围的人民币值"

exit function

end if

numstr = cstr(num * 100)

numlen = len(numstr)

n = 1

do while n <= numlen

numchar = cint(mid(numstr, n, 1))

n1 = mid(numlist, numchar + 1, 1)

n2 = mid(rmblist, numlen – n + 1, 1)

if not n1 = "零" then

hz = hz + cstr(n1) + cstr(n2)

else

if n2 = "亿" or n2 = "万" or n2 = "元" or n1 = "零" then

do while right(hz, 1) = "零"

hz = left(hz, len(hz) – 1)

loop

end if

if (n2 = "亿" or (n2 = "万" and right(hz, 1) <> "亿") or n2 = "元") then

hz = hz + cstr(n2)

else

if left(right(hz, 2), 1) = "零" or right(hz, 1) <> "亿" then

hz = hz + n1

end if

end if

end if

n = n + 1

loop

do while right(hz, 1) = "零"

hz = left(hz, len(hz) – 1)

loop

if right(hz, 1) = "元" then

hz = hz + "整"

end if

rmb = hz

end function

%>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 将数字转换成大写的金额换算函数-ASP教程,ASP应用
分享到: 更多 (0)

相关推荐

  • 暂无文章