文档介绍:[新版]vbscript下将小写金额转成大写金额vbscript下将小写金额转成大写金额更新日期:2006-10-0815:56网页教学网<%'--------------------数字向汉字转换的函数集合------------------------'作者:northsnow'日期:20061007'调用方法:a=convertNumToStr("")'功能:''将一串数字转成对应的汉字FunctionconvertNumToStr()functionconvertNumToStr(pNum)dimoNum,rValueoNum=pNum:rValue=""'如果给定的不是合理的数字,则返回空串constz_PatNum="^d+(.{1}d+)?$"setr====(oNum)thenConvertNumToStr=rValueexitfunctionendif'将数字前面无用的0去掉setrLjc=="^0{2,}([^.])"oNum=(oNum,"$1")="^0{2,}(.)"oNum=(oNum,"0$1")'将小数点前后部分分开arrNum=split(oNum,".")frontNum=arrNum(0)backNum=""ifubound(arrNum)>0thenbackNum=arrNum(1)'----转换小数点前面的数----oLen=len(frontNum)ifoLen=1then'只有一位rValue=(frontNum)elseifoLen=2then'只有两位if(mid(frontNum,1,1))<>"1"thenrValue=(mid(frontNum,1,1))rValue=rValue&getDigit(2)if(mid(frontNum,2,1))<>"0"thenrValue=rValue&(mid(frontNum,2,1))else'大于两位的情况dimcurPos,curNum,hasZerohasZero=false'表明在此前有没有相连接的零fori=1tooLencurPos=oLen-i+1curNum=mid(frontNum,i,1)ifcint(curNum)=0then'当前位数为零hasZero=true'当当前位为万位或者亿位,则进行处理if(curPos-1)mod4=0andcurPos>4thenrValue=rValue&getDigit(curPos)endifelse'当前位数不是零ifhasZerothenrValue=rValue&"零"hasZero=falseendifrValue=rValue&(curNum)&getDigit(curPos)endifnextendifrValue=rValue&"元"'转换小数点后面的ifbackNum<>""thenstrBack=""iflen(backnum)>2thenbacknum=