当前位置: 首页 > 图文教程 > 网络编程 > ASP > asp下返回以千分位显示数字格式化的数值

ASP
IIS访问ASP页面时报错The requested resource is in use.的解决办法
错误类型:Provider (0x80004005)未指定的错误 的一个处理方法
关于asp+access的安全问题分析
把RS.GetRows看得更清楚
asp下UTF-8页面乱码的解决方法
解决使用良精企业建站7.0未注册问题
在ASP中连接MySQL数据库的方法,最好的通过ODBC方法
flash与js通讯方法
ASP操作Excel相关技术总结
解决用Access数据库建站维护不便的问题的方法
ASP实现GB2312字符与区位码的相互转换的代码
对于ASP编码问题的深入研究与最终解决方案
ASP生成UTF-8编码的代码
删除A表中在B表中不存在的数据
动网防恶意广告比较有效的办法附asp代码
asp磁盘缓存技术使用的代码
网页语言编码及asp乱码问题解决方案
FSO遍历目录实现全站插马的代码
关于无限分级(ASP+数据库+JS)的实现代码
如何写ASP入库小偷程序

ASP 中的 asp下返回以千分位显示数字格式化的数值


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 94 ::
收藏到网摘: n/a

<%
'******************************
'函数: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
%>