当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP把长的数字用逗号隔开显示

ASP
认识和优化connection对象
优化你的ASP程序
ASP实现简单的网页保护
在ASP中限制同一表单被多次提交
Request 对象 属性和方法
asp的Request对象
全角与半角字符的相互转换的asp函数
asp session 使用数组
防止ASP Session丢失的方法
cookies和session的关系
无组件不能上传rar,zip其它非图片文件
网站设计时应注意的SEO细节
asp代码--fso创建文件夹
ASP转化ip地址为长整型数字
关于script的dictionary对象的用法
asp过滤不文明字符的函数
fso删除当前文件夹下所有的内容
asp中将字符转换成变量使用
asp数组随机排序
解决asp被杀毒软件误删的方法

ASP把长的数字用逗号隔开显示


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

 

以下为引用的内容:

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
%>
<html>
<body>
<%
aLongNumber = "12345678"
%>
An un-formatted number: <%=aLongNumber%><br>
The Comma formatted number: <%=Comma(aLongNumber)%>
</body>
</html>