[點晴永久免費OA]ASP把長的數字用逗號隔開顯示的代碼
當前位置:點晴教程→點晴OA辦公管理信息系統
→『 經驗分享&問題答疑 』
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> 該文章在 2022/6/22 0:13:35 編輯過 |
關鍵字查詢
相關文章
正在查詢... |