排序问题?简单,但我不会。在线等待。谢谢!

ouyanggz 2003-08-01 12:01:59
有两个相同长度的字符串,例:str1: 1,2,3,4,5,6,7,8,9,
str2: a,b,c,d,e,f,g,h,i,
要求:结合成:str=1,a;2,b;3,c;4,d;5,e;6,f;7,g;8,h;9,i;
我知道有split函数把数组分割开,但是我不知道,该怎样把他们结合起来。在线等待,谢谢!!!
...全文
31 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
summercat 2003-08-01
  • 打赏
  • 举报
回复
更正一下:
<%
str1="1,2,3,4,5,6,7,8,9"
a1=split(str1,",")
str2="a,b,c,d,e,f,g,h,i"
a2=split(str2,",")
c=""
for i=0 to ubound(a1)
c=c&a1(i)&"," &a2(i)&","
next
response.write c&"<br>"
d=split(c,",")
for i=0 to ubound(d)
response.write d(i)&"<br>"
next
%>
summercat 2003-08-01
  • 打赏
  • 举报
回复
更正一下:
<%
str1="1,2,3,4,5,6,7,8,9"
a1=split(str1,",")
str2="a,b,c,d,e,f,g,h,i"
a2=split(str2,",")
c=""
for i=0 to 8
c=c&a1(i)&"," &a2(i)&","
next
response.write c&"<br>"
d=split(c,",")
for i=1 to ubound(d)
response.write d(i)&"<br>"
next
%>
zorou_fatal 2003-08-01
  • 打赏
  • 举报
回复
<%
str1="1,2,3,4,5,6,7,8,9"
str2="a,b,c,d,e,f,g,h,i"
a=split(str1,",")
b=split(str2,",")
dim target
if ubound(a)=ubound(b) then
temp=2*ubound(a)
redim c (temp)
for i=0 to 2*ubound(a)-1
if (i mod 2 = 0) then
c(i)=b(i/2)
else
c(i)=a((i-1)/2)
end if
next
end if
for i= 0 to 2*ubound(a)
response.write c(i)
next
%>
baggio785 2003-08-01
  • 打赏
  • 举报
回复
用循环
str1_array(0)=1
str2_array(0)=a
str=str1_array(0&","&str2_array(0)&";"
summercat 2003-08-01
  • 打赏
  • 举报
回复
try:

str1="1,2,3,4,5,6,7,8,9"
a1=split(str1,",")
str2="a,b,c,d,e,f,g,h,i"
a2=split(str2,",")
cn=ubound(a1)+ubound(a2)
dim c()
for i=0 to cn
redim preserve c(i)
if i mod 2=0 then
c(i)=a1(i)
else
c(i)=a2(i)
end if
next
d=join(c,",")
response.write d


ouyanggz 2003-08-01
  • 打赏
  • 举报
回复
我的str还要保存起来啊,对了 redim 是什么意思啊?

28,408

社区成员

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

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