您现在的位置是:网站首页> 编程资料编程资料
asp下返回以千分位显示数字格式化的数值_应用技巧_
2023-05-25
218人已围观
简介 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
%>
'******************************
'函数: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 下产生任意位数随机密码的代码_应用技巧_
- asp 将日期格式化为需要的格式_应用技巧_
- asp实现取得数组中的最大值的代码_应用技巧_
- asp下取得客户端IP地址函数 转换IP地址函数_应用技巧_
- asp下实现截取字符串特定部分内容函数_应用技巧_
- asp去除所有的超级链接的两种方法 替换与正则_应用技巧_
- asp快速开发方法之数据操作实例代码第1/3页_ASP基础_
- asp Chr 函数 数字转字母的方法_ASP基础_
- ReSaveRemoteFile函数之asp实现查找文件保存替换的代码_应用技巧_
- ReplaceSaveRemoteFile 替换、保存远程图片 的代码_应用技巧_
