新微赢技术网

标题: 人民币数字转汉字 [打印本页]

作者: 小猫钓鱼tp    时间: 2009-11-24 02:06
标题: 人民币数字转汉字
<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>
作者: ahwx    时间: 2010-1-18 04:05
我十目一行也还是看不懂啊




欢迎光临 新微赢技术网 (http://bbs.weiying.cn/) Powered by Discuz! X3.2