ASP

本类阅读TOP10

·asp常用数据库连接方法和技巧
·无组件生成BMP验证码
·一些常用的辅助代码 (网络收藏)
·JavaScript实现的数据表格:冻结列、调整列宽和客户端排序
·VisualStudio.NET_2003及其 MSDN 下载地址
·ASP模拟MVC模式编程
·图片以二进制流输出到网页
·MD5加密算法 ASP版
·ASP.NET编程中的十大技巧
·改进 ASP 的字符串处理性能

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
将人民币的数字表示转化成大写表示

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

<%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
%>




相关文章

相关软件