asp下返回以千分位顯示數(shù)字格式化的數(shù)值
更新時間:2007年08月08日 11:42:09 作者:
<%
'******************************
'函數(shù):comma(str)
'參數(shù):str,待處理的數(shù)字
'作者:阿里西西
'日期:2007/7/12
'描述:返回以千分位顯示數(shù)字格式化的數(shù)值
'示例:<%=comma("120300")%>
'******************************
function comma(str)
if not(isnumeric(str)) or str = 0 then
result = 0
elseif len(fix(str)) < 4 then
result = str
else
pos = instr(1,str,".")
if pos > 0 then
dec = mid(str,pos)
end if
res = strreverse(fix(str))
loopcount = 1
while loopcount <= len(res)
tempresult = tempresult + mid(res,loopcount,3)
loopcount = loopcount + 3
if loopcount <= len(res) then
tempresult = tempresult + ","
end if
wend
result = strreverse(tempresult) + dec
end if
comma = result
end function
%>
'******************************
'函數(shù):comma(str)
'參數(shù):str,待處理的數(shù)字
'作者:阿里西西
'日期:2007/7/12
'描述:返回以千分位顯示數(shù)字格式化的數(shù)值
'示例:<%=comma("120300")%>
'******************************
function comma(str)
if not(isnumeric(str)) or str = 0 then
result = 0
elseif len(fix(str)) < 4 then
result = str
else
pos = instr(1,str,".")
if pos > 0 then
dec = mid(str,pos)
end if
res = strreverse(fix(str))
loopcount = 1
while loopcount <= len(res)
tempresult = tempresult + mid(res,loopcount,3)
loopcount = loopcount + 3
if loopcount <= len(res) then
tempresult = tempresult + ","
end if
wend
result = strreverse(tempresult) + dec
end if
comma = result
end function
%>
相關(guān)文章
ASP向Excel導(dǎo)數(shù)據(jù)(圖片)終結(jié)版 ASP操作Excel
ASP向Excel導(dǎo)數(shù)據(jù)(圖片)終結(jié)版 ASP操作Excel,需要的朋友可以參考下。2009-11-11
UpdatePanel觸發(fā)javascript腳本的方法附代碼
UpdatePanel觸發(fā)javascript腳本的方法附代碼...2007-10-10
ASP:ActiveX不能創(chuàng)建Scripting.FileSystemObject對象解決辦法
關(guān)于ActiveX不能創(chuàng)建Scripting.FileSystemObject對象的類似問題,大體上解決辦法都是類似的,主要是思想要清晰:首先考慮組件注冊問題,其次是組件權(quán)限問題,如果服務(wù)器配置沒有問題的話,那就仔細(xì)檢查一下你的程序源碼吧2011-11-11

