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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

  2021-03-18 我要评论
想了解asp下返回以千分位显示数字格式化的数值的相关内容吗,在本文为您仔细讲解的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:asp下返回以千分位显示数字格式化的数值,下面大家一起来学习吧。
<%
'******************************
'函数: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 
%>

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们