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)文章
關(guān)于WPF?WriteableBitmap類直接操作像素點的問題
WPF是微軟新一代圖形系統(tǒng),運行在.NET Framework 3.0及以上版本下,為用戶界面、2D/3D 圖形、文檔和媒體提供了統(tǒng)一的描述和操作方法,本文重點給大家介紹WPF?WriteableBitmap類直接操作像素點的問題,感興趣的朋友一起看看吧2022-01-01ASP正則表達(dá)式清除HTML指定標(biāo)簽的方法
這篇文章主要介紹了ASP正則表達(dá)式清除HTML指定標(biāo)簽的方法,告訴大家如何精準(zhǔn)的過濾掉某些特定的屬性標(biāo)簽和參數(shù),感興趣的小伙伴們可以參考一下2015-09-09