在第一个“/”之间剥离未知的字符范围。和第二个“/” [英] Strip unknown range of characters between first "/" and second "/"

查看:87
本文介绍了在第一个“/”之间剥离未知的字符范围。和第二个“/”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以帮助我找出在第一个/之间的

路径中删除未知范围的字符。和/在我的

网站上的某个文件夹路径中找到。


例如:/catamaranco/sales/boat/1.asp

例如:/ esserman / newseltter / 2004/03 /

例如:/ yachtservices / excel / reports /


我只希望退货:


" catamaranco"



" esserman"



游艇服务


感谢您的建议...

Jason

解决方案

<%

function stripStuff(str)

stripStuff = str

if instr(str," /" ;)<> instrRev(str," /")然后

strs = split(str," /")

stripStuff = strs(1)

结束如果

结束功能


response.write"< br>" &安培; stripStuff(" /catamaranco/sales/boat/1.asp")

response.write"< br>" &安培; stripStuff(" / esserman / newseltter / 2004/03 /")

response.write"< br>" &安培; stripStuff(" / yachtservices / excel / reports /")

%>


-
http://www.aspfaq.com/

(反向回复地址。)



< ja *** @ catamaranco.com>在消息中写道

新闻:#0 ************** @ TK2MSFTNGP09.phx.gbl ...

可能有些帮助m弄清楚在第一个/之间的路径中剥离未知范围的字符。和/在我/
网站上某处的文件夹路径中找到。

例如:/catamaranco/sales/boat/1.asp
例如:/ esserman / newseltter / 2004/03 / <例如:/ yachtservices / excel / reports /

我希望只返回:

catamaranco

esserman ;

yachtservices

感谢您的建议...
Jason


<非常感谢 - 非常感谢 - 完美无缺!


" Aaron [SQL Server MVP]" < TE ***** @ dnartreb.noraa>在消息中写道

news:uU ************** @ TK2MSFTNGP10.phx.gbl ...

<%
function stripStuff(str)
stripStuff = str
if instr(str," /")<> instrRev(str," /")然后
strs = split(str," /")
stripStuff = strs(1)
结束如果
结束函数

response.write"< br>" &安培; stripStuff(" /catamaranco/sales/boat/1.asp")
response.write"< br>" &安培; stripStuff(" / esserman / newseltter / 2004/03 /")
response.write"< br>" &安培; stripStuff(" / yachtservices / excel / reports /")
%>

http://www.aspfaq.com/
(反向回复地址。)


< ; JA *** @ catamaranco.com>在消息中写道
新闻:#0 ************** @ TK2MSFTNGP09.phx.gbl ...

可以帮助我解决问题第一个/之间的
a路径中的未知字符范围。和/在
我的网站上的某个文件夹路径中找到。

例如:/catamaranco/sales/boat/1.asp
例如:/ esserman / newseltter / 2004/03 / <例如:/ yachtservices / excel / reports /

我希望只返回:

catamaranco

esserman ;

yachtservices

感谢您的建议...
Jason




嗯:)对不起Aaron,在解压

字符串之后我遇到了一个额外的问题......我怎么会把剩余的东西拉出来''stuff''以及

到变量中的东西?


提取:" /sales/boat/1.asp"


x =" /catamaranco/sales/boat/1.asp"


我的最终目标是实现:


www。 &安培; stripStuff(" /catamaranco/sales/boat/1.asp")& " .COM" &安培; " /" &

stripTrailingStuff(X)


结果:www.catamaranco.com/sales/boat/1.asp"

< JA *** @ catamaranco.com>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...

非常感谢 - 完美的工作!

Aaron [SQL Server MVP]" < TE ***** @ dnartreb.noraa>在消息中写道
新闻:uU ************** @ TK2MSFTNGP10.phx.gbl ...

<%
function stripStuff (str)
stripStuff = str
if instr(str," /")<> instrRev(str," /")然后
strs = split(str," /")
stripStuff = strs(1)
结束如果
结束函数

response.write"< br>" &安培; stripStuff(" /catamaranco/sales/boat/1.asp")
response.write"< br>" &安培; stripStuff(" / esserman / newseltter / 2004/03 /")
response.write"< br>" &安培; stripStuff(" / yachtservices / excel / reports /")
%>

http://www.aspfaq.com/
(反向回复地址。)


< ; JA *** @ catamaranco.com>在消息中写道
新闻:#0 ************** @ TK2MSFTNGP09.phx.gbl ...

可以帮助我解决问题

第一个/之间的路径中未知的字符范围


和/在我网站上的某个文件夹路径中找到。

例如:/catamaranco/sales/boat/1.asp
例如:/ esserman / newseltter / 2004/03 /
例如:/ yachtservices / excel / reports /

我希望仅返回:

catamaranco

esserman

yachtservices

感谢您的建议...
Jason





Could some help m figure out to strip an unknown range of characters in a
path between the first "/" and "/" found in a folder path somewhere on my
site.

eg: /catamaranco/sales/boat/1.asp
eg: /esserman/newseltter/2004/03/
eg: /yachtservices/excel/reports/

I wish to return only:

"catamaranco"
or
"esserman"
or
"yachtservices"

Thanks for advice...
Jason

解决方案

<%
function stripStuff(str)
stripStuff = str
if instr(str, "/") <> instrRev(str, "/") then
strs = split(str, "/")
stripStuff = strs(1)
end if
end function

response.write "<br>" & stripStuff("/catamaranco/sales/boat/1.asp")
response.write "<br>" & stripStuff("/esserman/newseltter/2004/03/")
response.write "<br>" & stripStuff("/yachtservices/excel/reports/")
%>

--
http://www.aspfaq.com/
(Reverse address to reply.)


<ja***@catamaranco.com> wrote in message
news:#0**************@TK2MSFTNGP09.phx.gbl...

Could some help m figure out to strip an unknown range of characters in a
path between the first "/" and "/" found in a folder path somewhere on my
site.

eg: /catamaranco/sales/boat/1.asp
eg: /esserman/newseltter/2004/03/
eg: /yachtservices/excel/reports/

I wish to return only:

"catamaranco"
or
"esserman"
or
"yachtservices"

Thanks for advice...
Jason



Many thanks - works perfectly!

"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:uU**************@TK2MSFTNGP10.phx.gbl...

<%
function stripStuff(str)
stripStuff = str
if instr(str, "/") <> instrRev(str, "/") then
strs = split(str, "/")
stripStuff = strs(1)
end if
end function

response.write "<br>" & stripStuff("/catamaranco/sales/boat/1.asp")
response.write "<br>" & stripStuff("/esserman/newseltter/2004/03/")
response.write "<br>" & stripStuff("/yachtservices/excel/reports/")
%>

--
http://www.aspfaq.com/
(Reverse address to reply.)


<ja***@catamaranco.com> wrote in message
news:#0**************@TK2MSFTNGP09.phx.gbl...

Could some help m figure out to strip an unknown range of characters in a path between the first "/" and "/" found in a folder path somewhere on my site.

eg: /catamaranco/sales/boat/1.asp
eg: /esserman/newseltter/2004/03/
eg: /yachtservices/excel/reports/

I wish to return only:

"catamaranco"
or
"esserman"
or
"yachtservices"

Thanks for advice...
Jason




Umm :) sorry Aaron, I ran into an added problem after extracting the
string...how I would then also pull out the remaiing ''stuff'' and stuff that
into a variable?.

Extract: "/sales/boat/1.asp"

x= "/catamaranco/sales/boat/1.asp"

As my ultimate goal is concententation:

"www". & stripStuff("/catamaranco/sales/boat/1.asp") & ".com" & "/" &
stripTrailingStuff(X)

Result: www.catamaranco.com/sales/boat/1.asp"
<ja***@catamaranco.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...

Many thanks - works perfectly!

"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:uU**************@TK2MSFTNGP10.phx.gbl...

<%
function stripStuff(str)
stripStuff = str
if instr(str, "/") <> instrRev(str, "/") then
strs = split(str, "/")
stripStuff = strs(1)
end if
end function

response.write "<br>" & stripStuff("/catamaranco/sales/boat/1.asp")
response.write "<br>" & stripStuff("/esserman/newseltter/2004/03/")
response.write "<br>" & stripStuff("/yachtservices/excel/reports/")
%>

--
http://www.aspfaq.com/
(Reverse address to reply.)


<ja***@catamaranco.com> wrote in message
news:#0**************@TK2MSFTNGP09.phx.gbl...

Could some help m figure out to strip an unknown range of characters

in

a path between the first "/" and "/" found in a folder path somewhere on my site.

eg: /catamaranco/sales/boat/1.asp
eg: /esserman/newseltter/2004/03/
eg: /yachtservices/excel/reports/

I wish to return only:

"catamaranco"
or
"esserman"
or
"yachtservices"

Thanks for advice...
Jason





这篇关于在第一个“/”之间剥离未知的字符范围。和第二个“/”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆