Solved

instrrev using jscript

Posted on 2002-04-18
2
750 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
[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
2 Comments
 
LVL 23

Accepted Solution

by:
naveenkohli earned 100 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

710 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