Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trip to "/" 1

Status
Not open for further replies.

snowboardr

Programmer
Joined
Feb 22, 2002
Messages
1,401
Location
PH
How would I go about trimming to the slash in MyString..

Dim MyString

mystring = "/site/page.asp"

and return "page.asp"



 
Thats "trim" not "trip"

what a day.
 
Dim objFS
Dim strFilename
Set objFS = Server.CreateObject("Scripting.FileSystemObject")
strFileName = objFS,GetFilename(strNameWithSlash) Generate Forms/Controls Resizing/Tabbing Class
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
hey snowboardr
do you want to get rid of that in this string only or is this soemthing you want dynamicaly for a input field?
if this is the string that needs to have it done to
this should work out fine
<%
Dim MyString
MyString = &quot;/site/page.asp&quot;

MyString = Replace(MyString,&quot;/site/&quot;,&quot;&quot;,1,1)
Response.Write(MyString)
%> [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
Well im attempting to make a directory structure thing.. or whatever you would call it. Something like this..

/lesson/lesson_1.asp

on the page it would display...

Lesson > Lesson 1

etc..

And I also have to make Lesson a url, and lesson 1 a url
like so..

Lesson = /lesson/
Lesson 1 = /lesson/lesson_1.asp

Havn't come up with a way to do this yet..

I have used replace(ScriptName, &quot;/&quot;, &quot; > &quot;) but that still doesnt help me for the url, and capitalizing...

-Jason

 
you can manipulate the string this way to get the posrtions out
path = &quot;/lesson/lesson_1.asp&quot;
path = right(path, 12)
path = Replace(path,&quot;.asp&quot;,&quot;&quot;)
' returns lesson_1
'if you really wanted you can do another replace for the _

you actually don't trim off anything but cut off and show the portion you watn like
path = left(path, 1) 'returns /
path = right(path, 4) 'returns .asp


There has to be a easier way though and if someone else doesn't post it I'll find it. [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
rough but whadda ya expect fer a 5 min job

<%@ language=&quot;vbscript&quot;%>
<%dim str_filepath
dim lng_currentpointer
str_filepath= &quot;/mysite/classes/class1/lesson1/lesson1.asp&quot;
lng_currentpointer = instr(str_filepath, &quot;/&quot;)
while lng_currentpointer > 0
%> <a href=&quot;<%=left(str_filepath, lng_currentpointer)%>&quot;>
<% =left(str_filepath, lng_currentpointer)
%> </a><br />
<%
lng_currentpointer = instr(lng_currentpointer + 1, str_filepath, &quot;/&quot;)
wend
%> <a href=&quot;<%=str_filepath%>&quot;><%=str_filepath
%> </a><br /> codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
<insert witticism here>
 
Thought about it a bit now .. still a kludge, but ..

<%@enablesessionstate=&quot;false&quot; language=&quot;vbscript&quot;%>
<html>
<head>
<title>File Path Links Test</title>
</head>
<body>
<%dim str_filepath
dim lng_currentpointer
dim str_cumulativefilepath
str_filepath= &quot;/mysite/classes/class1/lesson1/lesson1.asp&quot;
str_filepath = split(str_filepath, &quot;/&quot;)
if isarray(str_filepath) then
str_cumulativefilepath = str_filepath(lbound(str_filepath))
for lng_currentpointer = lbound(str_filepath) to ubound(str_filepath)
str_cumulativefilepath = str_cumulativefilepath & &quot;/&quot; & _
str_filepath(lng_currentpointer)
if len(str_filepath(lng_currentpointer)) > 0 then
%> <a href=&quot;<%=str_cumulativefilepath%>&quot;>
<% Response.write str_filepath(lng_currentpointer)
%> </a>
<% end if
if lng_currentpointer < ubound(str_filepath) and _
lng_currentpointer > lbound(str_filepath) then
%>&nbsp;&gt;&nbsp;
<% end if
next
end if
%> </body>
</html>
codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
<insert witticism here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top