对于一些比较长的数字,我们可以用asp实现隔开显示,尤其是一些金钱相关的东西

000000000000000000000000000000000000000000000000000000000000000 代码如下: % FunctionComma(str) IfNot(IsNumeric(str))orstr=0Then Result=0 ElseIfLen(Fix(str))4Then Result=str Else Pos=Instr(1,str,'.') IfPos0Then Dec=Mid(str,Pos) Endif Res=StrReverse(Fix(st

作者: 来源: 时间: 17-11-23 15:46:41

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>
11
22
33
隐藏区块

会员注册

本功能为预留功能,暂不支持注册 ^_^

Login

社交帐号登陆

使用以下任意帐号可登陆本站

Close section
Close

联系我们

关于5UCMS 您有任何需求 均可以留言给我们