• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: 小 中 大 | 推荐给好友 上一篇 | 下一篇

将人民币的数字表示转化成大写表示

发布: 2007-6-30 18:56 | 作者: admin | 来源: | 查看: 32次 | 进入软件测试论坛讨论

领测软件测试网 <%call Money(22222222222)
function Money(thenumber)
dim Money,i,String1,String2,length,checkp‘’定义变量
dim one(),onestr()‘’定义数组

String1 = "零壹贰叁肆伍陆柒捌玖"
String2 = "万仟佰拾亿仟佰拾万仟佰拾元角分厘毫"

checkp=instr(thenumber,".")‘’判断是否含有小数位
if checkp<>0 then
thenumber=replace(thenumber,".","")‘’去除小数位
end if

length=len(thenumber) ‘’取得数据长度
redim one(length-1)‘’重新定义数组大小
redim onestr(length-1)‘’重新定义数组大小

for i=0 to length-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-length+i,1)
else
‘’含有小数的数据其数字对应的单位
onestr(i)=mid(string2,15-length+i+len(thenumber)-checkp,1)
end if

one(i)=one(i)&onestr(i)‘’将数字与单位组合
next

Money=replace(join(one)," ","") ‘’取得数组中所有的元素,并连接起来
Money=replace(Money,"零元","元")
Money=replace(Money,"零万","万")
Money=replace(Money,"零亿","亿")
Money=replace(Money,"零仟","零")
Money=replace(Money,"零佰","零")
Money=replace(Money,"零拾","零")

do while not instr(Money,"零零")=0
Money=replace(Money,"零零","零")
loop

response.write Money ‘’显示结果
end function
%>

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:[email protected] 电话:010-51297073

软件测试 | 领测国际 | ISTQB | ISTQB官网 | TMMi | TMMi认证 | 国际软件测试工程师认证 | 领测软件测试网