IT俱乐部 ASP.NET ASP将数字转中文数字(大写金额)的函数

ASP将数字转中文数字(大写金额)的函数

下面跟大家分享2种不同函数的实现方式。

ASP将数字转中文数字金额的函数一

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
Response.write Money(8200001)
%>

ASP阿拉伯数字转中文数字

1
2
3
4
5
6
7
8
9
10
11
12
13
14
0 then chnumstr=chnumstr&"十"
if i=strlen-2 and mid(num,i,1)0 then chnumstr=chnumstr&"百"
if i=strlen-3 and mid(num,i,1)0 then chnumstr=chnumstr&"千"
if i=strlen-4 and mid(num,i,1)0 then chnumstr=chnumstr&"万"
if i=strlen-5 and mid(num,i,1)0 then chnumstr=chnumstr&"十"
if i=strlen-6 and mid(num,i,1)0 then chnumstr=chnumstr&"百"
if i=strlen-7 and mid(num,i,1)0 then chnumstr=chnumstr&"千"
if i=strlen-8 and mid(num,i,1)0 then chnumstr=chnumstr&"万"
next
if left(chnumstr,1)="一" then chnumstr=right(chnumstr,len(chnumstr)-1)
if right(chnumstr,1)="零" then chnumstr=left(chnumstr,len(chnumstr)-1)
end function
Response.write chnumstr("84221213")
%>

到此这篇关于ASP将数字转中文数字(大写金额)的函数的文章就介绍到这了,更多相关ASP 数字转中文数字内容请搜索IT俱乐部以前的文章或继续浏览下面的相关文章希望大家以后多多支持IT俱乐部!

本文收集自网络,不代表IT俱乐部立场,转载请注明出处。https://www.2it.club/code/asp-net/2720.html
上一篇
下一篇
联系我们

联系我们

在线咨询: QQ交谈

邮箱: 1120393934@qq.com

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部