www.webdeveloper.com
Results 1 to 2 of 2

Thread: I'm trying to use InStrRev

  1. #1
    Join Date
    Aug 2004
    Posts
    82

    I'm trying to use InStrRev

    I'm trying to get part of a path. The complete path is c:\inetpub\wwwroot\drintranet\upload\filename.whatever. With the code below I'm searching the string for "\" at a designated position. For some reason it always returns the four characters before my designated start position and i can't figure out why. If I adjust the start position it will move to 5 characters before the next found \. Any ideas?



    Example of what it returns.

    ranet\upload\bb.pdf - I was looking for everything after the \ before upload.



    Code:
    Set Upload = Server.CreateObject("Persits.Upload.1") 
    Count = Upload.Save("c:\inetpub\wwwroot\drintranet\upload")
    Set curProcess = Upload.Form("txtprocess22") 
    Set curQuestion = Upload.Form("inQuestion") 
    Set curAnswer = Upload.Form("inAnswer") 
    Set curDepartment = Upload.Form("qaSelect") 
    
    curDate=date
    
    curFile = Upload.Files("qaFile").Path
    Dim curFlnm, curChar
    curChar="\"
    curFlnm = Right(curFile, InStrRev(curFile, curChar, 25, 0))

  2. #2
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    You could use Split()
    Code:
    Dim arrURL: arrURL = Split(curFile, curChar)
    curFlnm = CStr(arrURL(UBound(arrURL)-2) & "/" & arrURL(UBound(arrURL)--1))
    Regards.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles