asp下返回以千分位显示数字格式化的数值
2007-08-08 11:42
716 查看
<%
'******************************
'函数: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.net显示相同数字相乘的结果,直到数值大于150为止
- ios中数字的格式化(金额千分位格式化显示)
- ios中数字的格式化(金额千分位格式化显示)
- asp.net显示相同数字相乘的结果,直到数值大于150为止
- input只能输入数字,格式化数值的显示
- asp.net 中日期的格式化显示的方法
- Asp.net日期字符串格式化显示
- Oracle日期、字符串格式化函数,位数不足前面加0,一位数字显示两位,格式化数字为定长
- js数字格式化(加千分位逗号)
- Asp.net日期字符串格式化显示方法
- JavaScript 格式化数字、金额、千分位、保留几位小数、舍入舍去…
- Asp.net日期字符串格式化显示
- 数字的千分位格式化方法
- 千分位数字格式化(用逗号隔开 代码已做了修改 支持0-9位逗号隔开)的JS代码
- Asp.net日期字符串格式化显示方法
- JS,数字千分位格式化
- C#(ASP.NET)DateTime日期类型格式化显示
- Asp.net日期字符串格式化显示方法[转]
- 在ASP中按指定参数格式化显示时间的函数