asp循环显示变量加上顿号?怎么让最后一个顿号不显示

weixin_46430414 2020-04-09 04:19:27
<% for i = 0 to UBound(mh)
response.write(mh(i)& "、")
next
%>
怎么让最后一个顿号没有???
...全文
502 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
无·法 2020-04-17
  • 打赏
  • 举报
回复
方法1:
<% for i = 0 to UBound(mh)
if i=UBound(mh) then
response.write(mh(i))
else
response.write(mh(i)& "、")
end if
next
%>

方法2:
<% for i = 0 to UBound(mh)-1
response.write(mh(i)& "、")
next
response.write(mh(i))
%>
三楼の郎 2020-04-14
  • 打赏
  • 举报
回复
<% dim str for i = 0 to UBound(mh) str=str & mh(i) & "、" next response.write(left(str,len(str)-1)) %>
hookee 2020-04-11
  • 打赏
  • 举报
回复
Response.Write Join(mh, "、")
csdn_aspnet 2020-04-10
  • 打赏
  • 举报
回复
参考代码:

dim a
a="abcd"
strleng=len(a) '获取长度
response.Write(left(a,strleng-1)) '用left函数,总长-1就得到abc

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧