国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

ASP把長的數(shù)字用逗號隔開顯示的代碼

2024-05-04 11:09:27
字體:
供稿:網(wǎng)友
對于一些比較長的數(shù)字,我們可以用asp實現(xiàn)隔開顯示,尤其是一些金錢相關(guān)的東西
 
 
 
000000000000000000000000000000000000000000000000000000000000000 
復(fù)制代碼代碼如下:

<% 
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>

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 东宁县| 潜山县| 建昌县| 和平区| 马山县| 彰化市| 油尖旺区| 临朐县| 恩平市| 浙江省| 长乐市| 酉阳| 兴宁市| 镇巴县| 罗城| 丹凤县| 武安市| 绍兴县| 盐源县| 东乌珠穆沁旗| 韩城市| 加查县| 铅山县| 双鸭山市| 崇信县| 定州市| 孟连| 定日县| 奎屯市| 米林县| 贵德县| 百色市| 汉川市| 巴马| 正安县| 铅山县| 通山县| 海晏县| 东乌珠穆沁旗| 正阳县| 武城县|