| 发表于:2007-08-02 09:46:043楼 得分:4 |
string dw,upca[10],sz,nextup,locdw,rslt,ls integer poip,scode,szlen,zeronu dw = '分角元拾佰仟万拾佰仟亿拾 ' upca[1] = "零 " upca[2] = "壹 " upca[3] = "贰 " upca[4] = "叁 " upca[5] = "肆 " upca[6] = "伍 " upca[7] = "陆 " upca[8] = "柒 " upca[9] = "捌 " upca[10] = "玖 " rslt = " " sz = string(money*100, '############ ') if left(sz,1) = '- ' then ls = '负 ' sz = right(sz,len(sz) -1) else ls = ' ' end if szlen = len(sz) for poip = szlen to 1 step -1 scode = integer(mid(sz,poip,1)) locdw = mid(dw,2*(szlen - poip)+1,2) if scode = 0 then if pos( "亿元 ",locdw) <> 0 or locdw = "万 " and mid(sz,poip - 3,3) <> "000 " then rslt = locdw + rslt else rslt = upca[scode+1] + rslt end if else rslt = upca[scode+1] + mid(dw,2*(szlen - poip)+1,2) + rslt end if next poip = pos(rslt,upca[1],1) do while poip <> 0 zeronu = 0 nextup = mid(rslt,poip+2,2) do while nextup = upca[1] zeronu = zeronu + 2 nextup = mid(rslt,poip+2+zeronu,2) loop if pos( "亿万元 ",nextup) <> 0 then zeronu = zeronu + 2 poip = poip - 2 end if rslt = replace(rslt,poip+2,zeronu, " ") poip = pos(rslt,upca[1],poip+2) loop if right(rslt,2) = upca[1] then szlen = len(rslt) - 1 if szlen = 1 then rslt = " " else rslt = replace(rslt,szlen,2, "整 ") end if end if rslt = ls + rslt return rslt | | |
|