白云岛资源网 Design By www.pvray.com
<%
a="日本是中国的一个省|我们美丽中国的张家界!"
b="中国,我们,张家界,日本,美国,苹果"
b=split(b,",")
a=split(a,"|")
for k=0 to ubound(a)
s=""
n=""
for i=0 to ubound(b)
if instr(a(k),b(i))>0 then
s=s & instr(a(k),b(i)) & "," &instr(a(k),b(i))+len(b(i)) & ","
end if
next
s=left(s,len(s)-1)
if left(s,len(s)-1)<>len(a(k)) then s=s&","&len(a(k))+1
s=sort(split(s,","))
for i=0 to ubound(s)-1
n=n&mid(a(k),s(i),s(i+1)-s(i))& "|"
next
response.write n & "<br>"
next
function sort(ary)
ck=true
do Until ck = false
ck=false
For f = 0 to UBound(ary) -1
if clng(ary(f))>clng(ary(f+1)) then
v1=clng(ary(f))
v2=clng(ary(f+1))
ary(f)=v2
ary(f+1)=v1
ck=true
end if
next
loop
sort=ary
end function
%>
运行结果
日本|是|中国|的一个省|
我们|美丽|中国|的|张家界|!|
a="日本是中国的一个省|我们美丽中国的张家界!"
b="中国,我们,张家界,日本,美国,苹果"
b=split(b,",")
a=split(a,"|")
for k=0 to ubound(a)
s=""
n=""
for i=0 to ubound(b)
if instr(a(k),b(i))>0 then
s=s & instr(a(k),b(i)) & "," &instr(a(k),b(i))+len(b(i)) & ","
end if
next
s=left(s,len(s)-1)
if left(s,len(s)-1)<>len(a(k)) then s=s&","&len(a(k))+1
s=sort(split(s,","))
for i=0 to ubound(s)-1
n=n&mid(a(k),s(i),s(i+1)-s(i))& "|"
next
response.write n & "<br>"
next
function sort(ary)
ck=true
do Until ck = false
ck=false
For f = 0 to UBound(ary) -1
if clng(ary(f))>clng(ary(f+1)) then
v1=clng(ary(f))
v2=clng(ary(f+1))
ary(f)=v2
ary(f+1)=v1
ck=true
end if
next
loop
sort=ary
end function
%>
运行结果
日本|是|中国|的一个省|
我们|美丽|中国|的|张家界|!|
白云岛资源网 Design By www.pvray.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
白云岛资源网 Design By www.pvray.com
暂无评论...