asp下返回以千分位显示数字格式化的数值
更新时间:2007年08月08日 11:42:09 作者:
<%
'******************************
'函数:comma(str)
'参数:str,待处理的数字
'作者:阿里西西
'日期:2007/7/12
'描述:返回以千分位显示数字格式化的数值
'示例:<%=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
%>
'******************************
'函数:comma(str)
'参数:str,待处理的数字
'作者:阿里西西
'日期:2007/7/12
'描述:返回以千分位显示数字格式化的数值
'示例:<%=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
%>
相关文章
ASP向Excel导数据(图片)终结版 ASP操作Excel
ASP向Excel导数据(图片)终结版 ASP操作Excel,需要的朋友可以参考下。2009-11-11
UpdatePanel触发javascript脚本的方法附代码
UpdatePanel触发javascript脚本的方法附代码...2007-10-10
ASP:ActiveX不能创建Scripting.FileSystemObject对象解决办法
关于ActiveX不能创建Scripting.FileSystemObject对象的类似问题,大体上解决办法都是类似的,主要是思想要清晰:首先考虑组件注册问题,其次是组件权限问题,如果服务器配置没有问题的话,那就仔细检查一下你的程序源码吧2011-11-11


最新评论