加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

使用asp可以跳转到数值并以千分为单位进行数位处理

发布时间:2023-09-18 15:02:00 所属栏目:Asp教程 来源:
导读:示例:<%=comma("120300")%>

&#39;******************************

function comma(str)

if not(isnumeric(str)) or str = 0 then

result = 0

elseif len(fix(str)) < 4 then

result = str
示例:<%=comma("120300")%>
 
'******************************
 
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
 
%>
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章