asp的一个小问题,帮个忙!

来源:百度知道 编辑:UC知道 时间:2024/07/05 08:30:13
程序是:
<%
test="test/ttt#eee"
nt=instr(test,"/")
nnt=left("test",nt-1)
%>
nt=<%=nt%>
nnt=<%=nnt%>
得出NT是5,NNT是test,我现在的问题是假如我要得出结果是取出TEST里面的eee程序要怎么做,以及要取出TEST的ttt又要怎么做,第三个问题就是假如test里面有两个"/"我想指定第二个为准要怎么做?
以及instrrev有什么作用

用分割的方法比较直观
<%
test="test/ttt#eee"
a = split(test, "#") '此时a(0)="test/ttt" a(1)="eee"
response.write(a(1)) '输出eee
b = split(a(0), "/") '此时b(0)="test" a(1)="ttt"
response.write(b(1)) '输出ttt
%>
test里面有两个"/"
假设test = "aaa/bbb/ccc"
取bbb可以这样
<%
test = "aaa/bbb/ccc"
response.write(split(test,"/")(1))
%>
instrrev函数和instr功能差不多,instr是从左开始,instrrev是从右开始