?
Solved

ASP substring

Posted on 2005-03-04
7
Medium Priority
?
12,741 Views
Last Modified: 2012-06-22
Hello,

I need to extract the folder from the filepath. The filepath is as follows:
/Files/Letters/Letters1.asp

What I need from this is:
/Files/Letters/

What is the easy way to do this??
Thank you
0
Comment
Question by:lathashankar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 33

Expert Comment

by:Big Monty
ID: 13460555
try:

str = "/Files/Letters/Letters1.asp"
path = Left(str, Len(str) - InStrRev(str, "/")-2)

B.D.
0
 
LVL 33

Accepted Solution

by:
Big Monty earned 1000 total points
ID: 13460559
sorry, should be:

str = "/Files/Letters/Letters1.asp"
path = Left(str, Len(str) - InStrRev(str, "/")+2)

B.D.
0
 
LVL 33

Assisted Solution

by:hongjun
hongjun earned 1000 total points
ID: 13460564
try this

<%
Dim str

str = "/Files/Letters/Letters1.asp"
Response.Write Left(str, InStrRev(str, "/"))
%>
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 33

Expert Comment

by:hongjun
ID: 13460572
There's no need to use the Len function here.
Think mine http:#13460564 is sufficient and simpler.


hongjun
0
 

Author Comment

by:lathashankar
ID: 13460602
Thank you both for your immediate assistance
0
 

Author Comment

by:lathashankar
ID: 13460660
How do I get just the name of the file??
0
 
LVL 33

Expert Comment

by:hongjun
ID: 13460719
@lathashankar
This is a second question and strictly speaking, you should post another question.
But I will post the solution here anyway. If you wish to award me points for this second question, you can do so by opening a new ASP question titled "points to hongjun" and stating it is because of this question :) But if you do not wish to open another question, it's still okay.

<%
Dim str

str = "/Files/Letters/Letters1.asp"
Response.Write Right(str, Len(str) - InStrRev(str, "/"))
%>

hongjun
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question