Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

instrrev using jscript

Posted on 2002-04-18
2
Medium Priority
?
769 Views
Last Modified: 2008-02-01
I need to achieve the following piece of vbscript using jscript,
sMapPath = Server.MapPath("\")
sMapPath = Mid(sMapPath, 1, InStrRev(sMapPath,"\")-1) & "\db\mydb.mdb;"

So I basically need jscript equivilants of Mid and InStrRev
0
Comment
Question by:awestrope
2 Comments
 
LVL 23

Accepted Solution

by:
naveenkohli earned 400 total points
ID: 6951482
Mid <--> substr
InStrRev <--> lastIndexOf

I think following snippet should work.. I haven't tried it.

var sMapPath = Server.MapPath("\");
sMapPath = sMapPath.substr(0, sMapPath.lastIndexOf("\")-1);
sMapPath = sMapPath + "\db\mydb.mdb;";
0
 

Author Comment

by:awestrope
ID: 6951556
Close, helped me get there anyway!
sMapPath = Server.MapPath("\\");
sMapPath = sMapPath.substr(0, sMapPath.lastIndexOf("\\"));
sMapPath = sMapPath + "\\db\\mydb.mdb;";
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 recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Loops Section Overview
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

783 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