Subject: extracting substrings
Posted By: Nazu Post Date: 11/13/2003 6:51:54 AM
Hello there!
I've looked this over a hundred times and can't seem to figure out WHY I keep getting this error message....

Microsoft VBScript runtime error '800a01a8'
Object required: 'F:/data/raster/1000k'
/IS5i/i_test.asp, line 148


Here is the code:
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/if mRasters.EOF then
        response.write("pas de rasters selectionné")
    else
        ReDim arrRasters(0)
        i=0
        do while not mRasters.EOF
            arrRasters(i)=mRasters("IMAGE")
            mRasters.MoveNext
            i=i+1
        loop
        for i=0 to Ubound(arrRasters)
            response.write(arrRasters(i)&" <br>")
        next
    end if
    mRasters.close
    for i=0 to Ubound(arrRasters)
                lImage = CStr(arrRasters(i))
***************************************************
HERE------>        laLimite = lImage.lastindexof("/")
******************************************************
        nomImage = CStr(lImage.substring(laLimite,lImage.length))
        repertoire = CStr(lImage.substring(0,laLimite))
        response.write("le nom du raster est: "&nomImage&" et son chemin est: "&repertoire)
    next
    
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ 
I've checked to see what the actual string looks like and it's something like this F:/data/raster/1000k/mic98/6_4.tif


I really don't get what could be wrong :o( so any clue would be greatly appreciated!

Thanks all!

"Don't you ever feel as though your computer is possessed?"
Reply By: Jonax Reply Date: 11/13/2003 7:01:17 AM
Look up the instrrev-function...
I think what you need is something like this:

laLimite = instrrev(lImage, "/")


Reply By: Jonax Reply Date: 11/13/2003 7:18:03 AM
I think you are mixing JavaScript in your VBScript...
The lines following will also give you errors...

Rewrite along these lines:

nomImage = CStr(right(lImage,len(lImage)-laLimite))
repertoire = CStr(left(lImage,laLimite))

Reply By: Nazu Reply Date: 11/13/2003 8:06:01 AM
Yep it all works just fine!!!  :o)

Thanks to both of you!! :o*

"Don't you ever feel as though your computer were possessed?"
Reply By: Jonax Reply Date: 11/13/2003 8:32:28 AM
Both of me ;) are happy to help...

Reply By: Nazu Reply Date: 11/13/2003 10:56:48 AM
LOL
look at that! I'm so caught up in what I'm doing that I'm mixing everything up! Let me explain: I had two answers on different forums so I went ahead and thanked both of you!!
which reminds me : I didn't go back to thank the other guy! (ain't that pathetic!)

"Don't you ever feel as though your computer were possessed?"

Go to topic 6324

Return to index page 1006
Return to index page 1005
Return to index page 1004
Return to index page 1003
Return to index page 1002
Return to index page 1001
Return to index page 1000
Return to index page 999
Return to index page 998
Return to index page 997