今天整理文件时发现了以前写的货币金额中文转换(转换一亿亿元以下数目的货币)的代码,帖出来与大家共享:
function daxie(money as string) as string ´ 【相关文章:调用Shell接口(系统运行窗口)的代码】
【扩展阅读:在C#中操作XML】
dim x as string, y as string 【扩展信息:ASP+ACCESS实现的无限级目录树】 const zimu = ".sbqwsbqysbqwsbq" ´定义位置代码 const letter = "0123456789sbqwy.zjf" ´定义汉字缩写 const upcase = "零壹贰叁肆伍陆柒捌玖拾佰仟萬億圆整角分" ´定义大写汉字 dim temp as string temp = money if instr(temp, ".") > 0 then temp = left(temp, instr(temp, ".") - 1)if len(temp) > 16 then msgbox "数目太大,无法换算!请输入一亿亿以下的数字", 64, "错误提示": exit function ´只能转换一亿亿元以下数目的货币!
x = format(money, "0.00") ´格式化货币
y = "" for i = 1 to len(x) - 3 y = y & mid(x, i, 1) & mid(zimu, len(x) - 2 - i, 1) next if right(x, 3) = ".00" then y = y & "z" ´***元整 else y = y & left(right(x, 2), 1) & "j" & right(x, 1) & "f" ´*元*角*分 end if ... 下一页