All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
SQL server2000中char和varchar字符型数据类型的区别_[SQL Server教程]
GDI+中的元文件
ASP.NET,2.0服务器控件开发精要_[Asp.Net教程]
灵活调用xsl来解析xml文档(js异步)_JavaScript技术_编程技术
C#教程:COM+的概念
小结:几点提高php序运行效率的方法_php资料_编程技术
XMLHttpRequest和AJAX入主Web开发_[AJAX教程]
VB.NET实现窗体图标最小化到状态栏_.net资料_编程技术
Asp.net关于Header/title/Meta,tages/Style操作的小技巧_[Asp.Net教程]
C#2.0基本语法二_[Asp.Net教程]
Reading number is top 10 pictures
白嫩丰满美女照片
Sora aoi possession photo1
The real super beauty1
浴室里的美女
29 the belle stars after bath figure3
Startling Russian girl blind date scene2
So beauty, will let you spray blood4
Ashlynn Brooke photograph of a group2
Sora aoi mirror memorial classics1
Park waits to have her picture taken exposed
Download software ranking
Tram sex maniac 2 (H) rar bag18
Tram sex maniac 2 (H) rar bag6
在线棋牌游戏3.05版
Take off clothes to survival
Tram sex maniac 2 (H) rar bag2
SQL2000 For 4IN1
少妇苏霞全本
Sora aoi, the nurse, uniform ,nursing assistant
matrix3
卡丁车单机版
delv published in(发表于) 2013/12/31 6:36:23 Edit(编辑)
vbscript下将小写金额转成大写金额_JavaScript技术_编程技术

vbscript下将小写金额转成大写金额_JavaScript技术_编程技术

vbscript下将小写金额转成大写金额_JavaScript技术_编程技术-你的首页-uuhomepage.com

<%
'--------------------数字向汉字转换的函数集合 ------------------------
'作者:northsnow
'日期:20061007
'调用方法: a=convertNumToStr("1234.5678")
'功能: 将这样的串 1234.5678 转换成 壹仟贰佰叁拾肆元伍角陆分



''将一串数字转成对应的汉字
Function convertNumToStr()function convertNumToStr(pNum)
dim oNum,rValue
oNum=pNum:rValue=""

'如果给定的不是合理的数字,则返回空串
const z_PatNum="^d+(.{1}d+)?$"
set r=new regexp
r.Pattern=z_PatNum
r.IgnoreCase=false
r.Global=false
if not r.Test(oNum) then
ConvertNumToStr=rValue
exit function
end if

'将数字前面无用的0去掉
set rLjc=new RegExp
rLjc.Pattern="^0{2,}([^.])"
oNum=rLjc.Replace(oNum,"$1")
rLjc.Pattern="^0{2,}(.)"
oNum=rLjc.Replace(oNum,"0$1")

'将小数点前后部分分开
arrNum=split(oNum,".")
frontNum=arrNum(0)
backNum=""
if ubound(arrNum)>0 then backNum=arrNum(1)

'---- 转换小数点前面的数----
oLen=len(frontNum)

if oLen=1 then '只有一位
rValue=convertNumToCC(frontNum)
elseif oLen=2 then '只有两位
if(mid(frontNum,1,1))<>"1" then rValue=convertNumToCC(mid(frontNum,1,1))
rValue=rValue & getDigit(2)
if(mid(frontNum,2,1))<>"0" then rValue=rValue & convertNumToCC(mid(frontNum,2,1))
else '大于两位的情况
dim curPos,curNum,hasZero
hasZero=false '表明在此前有没有相连接的零
for i=1 to oLen
curPos=oLen-i + 1
curNum=mid(frontNum,i,1)
if cint(curNum)=0 then '当前位数为零
hasZero=true
'当当前位为万位或者亿位,则进行处理
if (curPos -1) mod 4=0 and curPos>4 then
rValue=rValue & getDigit(curPos)
end if
else '当前位数不是零
if hasZero then
rValue=rValue & "零"
hasZero=false
end if
rValue=rValue & convertNumToCC(curNum) & getDigit(curPos)
end if
next
end if
rValue=rValue & "元"
'转换小数点后面的
if backNum<>"" then
strBack=""
if len(backnum)>2 then
backnum=left(backnum,2)
end if
for i=1 to len(backNum)
strBack=strBack & convertNumToCC(mid(backNum,i,1)) & getDigit2(i)
next
rValue=rValue & strBack
else
rValue=rValue & "整"
end if
convertNumToStr=rValue
end function


''将一个数字转成对应的汉字
Function convertNumToCC()function convertNumToCC(pNum)
select case pNum
case 1:convertNumToCC="壹"
case 2:convertNumToCC="贰"
case 3:convertNumToCC="叁"
case 4:convertNumToCC="肆"
case 5:convertNumToCC="伍"
case 6:convertNumToCC="陆"
case 7:convertNumToCC="柒"
case 8:convertNumToCC="捌"
case 9:convertNumToCC="玖"
case 0:convertNumToCC="零"
end select
end function

'根据位数返回对应的汉字
Function getDigit()function getDigit(oDigit)
if oDigit=1 then

elseif (oDigit+2) mod 4=0 then
getDigit="拾"
elseif (oDigit +1) mod 4=0 then
getDigit="佰"
elseif oDigit mod 4=0 then
getDigit="仟"
elseif (oDigit -1) mod 4=0 then
if ((oDigit-1)/4) mod 2=0 then
getDigit="亿"
else
getDigit="万"
end if
end if
end function


Function getDigit2()function getDigit2(oDigit)
if oDigit=1 then
getDigit2="角"
elseif oDigit=2 then
getDigit2="分"
end if
end function


dim aaa
aaa="108765.54"
response.Write aaa
response.Write convertNumToStr(aaa)


%>





添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.