lastIndexOf slash?

Hello,

Im trying to use the lastIndexOf function to discover where the last “” is located in my string… It seems to have a pb with the \ symbol…
I tried mystring.lastIndexOf(’""’) and every other possibleway, it always returns -1

Any ideas?

use “\” since it is used in combination with escape characers (like
and ), it, itself, has to be escaped

Ok i’ve found a way…
heh = String.fromCharCode(92);
lastslashpos = myvar.lastIndexOf(heh);
That seems to work with the ascii code…

Thanks for your reply tho

senocular’s ver is simpler ?

lastslashpos = myvar.lastIndexOf("\");