|
<script language=vbscript>
function Money222(asdf)
thenumber=asdf
dim one(),onestr()//定义数组
String1 = "零壹贰叁肆伍陆柒捌玖"
String2 = "万仟佰拾亿仟佰拾万仟佰拾元角分厘毫"
checkp=instr(thenumber,".")//判断是否含有小数位
if checkp<>0 then
thenumber=replace(thenumber,".","")//去除小数位
end if
length1=len(thenumber) //取得数据长度
redim one(length1-1)//重新定义数组大小
redim onestr(length1-1)//重新定义数组大小
for i=0 to length1-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-length1+i,1)
else//含有小数的数据其数字对应的单位
onestr(i)=mid(string2,15-length1+i+len(thenumber)-checkp,1)
end ifone(i)=one(i)&onestr(i)//将数字与单位组合
next
Money11=replace(join(one)," ","") //取得数组中所有的元素,并连接起来Money11=replace(Money11,"零万","万")
Money11=replace(Money11,"零亿","亿")
Money11=replace(Money11,"零仟","零")
Money11=replace(Money11,"零佰","零")
Money11=replace(Money11,"零拾","零")
do while not instr(Money11,"零零")=0
Money11=replace(Money11,"零零","零")
loop
Money11=replace(Money11,"零元","元")
Money222=Money11
end function
msgbox money222(12345678901)
</script> |
|