您现在的位置是:网站首页> 编程资料编程资料
ASP把长的数字用逗号隔开显示的代码_应用技巧_
2023-05-25
379人已围观
简介 ASP把长的数字用逗号隔开显示的代码_应用技巧_
000000000000000000000000000000000000000000000000000000000000000
<%
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
%>
<%
aLongNumber = "12345678"
%>
An un-formatted number: <%=aLongNumber%>
The Comma formatted number: <%=Comma(aLongNumber)%>
复制代码 代码如下:
<%
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
%>
<%
aLongNumber = "12345678"
%>
An un-formatted number: <%=aLongNumber%>
The Comma formatted number: <%=Comma(aLongNumber)%>
相关内容
- asp按关键字查询XML的代码_应用技巧_
- ASP XML编程objXML.async = False第1/2页_应用技巧_
- 一个asp版XMLDOM操作类_应用技巧_
- asp下查询xml的实现代码_应用技巧_
- asp截取指定英汉混合字符串_支持中文_应用技巧_
- utf-8 网页不显示+utf-8网页乱码的通用解决方法_应用技巧_
- Asp生成RSS的类_给网站加上RSS第1/2页_应用技巧_
- ASP UTF-8页面乱码+GB2312转UTF-8 +生成UTF-8格式的文件(编码)第1/2页_应用技巧_
- ASP运行在IIS6 500错误解决办法_应用技巧_
- js table排序类代码_应用技巧_
