Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

ASP substring

Posted on 2005-03-04
7
Medium Priority
?
12,745 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
  • 3
  • 2
  • 2
7 Comments
 
LVL 34

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 34

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
Industry Leaders: 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

580 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