您的位置:首页 > 编程语言 > ASP

ASP阿拉伯数字转中文数字

2007-12-22 15:57 162 查看

################################


函数名:阿拉伯数字转中文数字函数


################################


function chnumstr(num)


num=int(abs(num))


strlen=len(num)


for i=1 to strlen


select case mid(num,i,1)


case 1:chnum="一":case 2:chnum="二":case 3:chnum="三"


case 4:chnum="四":case 5:chnum="五"


case 6:chnum="六":case 7:chnum="七":case 8:chnum="八"


case 9:chnum="九":case 0:chnum="零"


end select


chnumstr=chnumstr&chnum


if i=strlen-1 and mid(num,i,1)<>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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: