主页 > 知识库 > ASP把长的数字用逗号隔开显示的代码

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

热门标签:电子围栏 银行业务 Linux服务器 科大讯飞语音识别系统 阿里云 服务器配置 团购网站 Mysql连接数设置
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>

标签:江苏 广元 衡水 衢州 蚌埠 大理 萍乡 枣庄

巨人网络通讯声明:本文标题《ASP把长的数字用逗号隔开显示的代码》,本文关键词  ;如发现本文内容存在版权问题,烦请提供相关信息告之我们,我们将及时沟通与处理。本站内容系统采集于网络,涉及言论、版权与本站无关。
  • 相关文章
  • 收缩
    • 微信客服
    • 微信二维码
    • 电话咨询

    • 400-1100-266