欢迎光临
我们一直在努力

将人民币的数字表示转化成大写表示-ASP教程,ASP应用

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

<%call money(22222222222)

function money(thenumber)

dim money,i,string1,string2,length,checkp定义变量

dim one(),onestr()定义数组

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

string2 = "万仟佰拾亿仟佰拾万仟佰拾元角分厘毫"

checkp=instr(thenumber,".")判断是否含有小数位

if checkp<>0 then

thenumber=replace(thenumber,".","")去除小数位

end if

length=len(thenumber) 取得数据长度

redim one(length-1)重新定义数组大小

redim onestr(length-1)重新定义数组大小

for i=0 to length-1

one(i)=mid(thenumber,i+1,1) 循环取得每一位的数字

one(i)=mid(string1,one(i)+1,1)循环取得数字对应的大写

if checkp=0 then

不含有小数的数据其数字对应的单位

onestr(i)=mid(string2,14-length+i,1)

else

含有小数的数据其数字对应的单位

onestr(i)=mid(string2,15-length+i+len(thenumber)-checkp,1)

end if

one(i)=one(i)&onestr(i)将数字与单位组合

next

money=replace(join(one)," ","") 取得数组中所有的元素,并连接起来

money=replace(money,"零元","元")

money=replace(money,"零万","万")

money=replace(money,"零亿","亿")

money=replace(money,"零仟","零")

money=replace(money,"零佰","零")

money=replace(money,"零拾","零")

do while not instr(money,"零零")=0

money=replace(money,"零零","零")

loop

response.write money 显示结果

end function

%>

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

相关推荐

  • 暂无文章