人民币数字转汉字

<SCRIPT LANGUAGE=vbs>
N=34334100000.0502'假设N不是负数,末尾不带0
Snz=split(cstr(N),".")(0)'整数部分转字串
A=array( "零","壹","贰","叁","肆","伍","陆","柒","捌","玖")
B=array("元","拾","佰","仟","万","拾","佰","仟","亿","拾","佰","仟","万")
C=array("角","分","厘","毫")
WeiSz=len(cstr(int(Snz)))'整数位数
for i=1 to WeiSz      
              JieG=JieG & A(cint(mid(Snz,i,1)))       
              if cint(mid(Snz,i,1))<>0 or _
              (WeiSz-i)=0 or (WeiSz-i)=4 or _
              (WeiSz-i)=8 or (WeiSz-i)=12  then JieG=JieG & B(WeiSz-i)
JieG=replace(JieG,"零零","")
next
JieG=replace(JieG,"零","")
if N<>int(N) then
       JieG=JieG & "零"
       Snx=split(cstr(N),".")(1)'小数部分转字串
       WeiSx=len(cstr(int(Snx)))'小数位数
       for i=1 to WeiSx      
              if cint(mid(Snx,i,1))=0 then i=i+1             
              JieG=JieG & A(cint(mid(Snx,i,1))) & C(i-1)
       next
end if
msgbox JieG
</SCRIPT>
原文网址:http://xxrblog.cn/article.asp?id=397
posted on 2008-12-17 10:33  草原和大树  阅读(468)  评论(0编辑  收藏  举报