-2

I need help on getting the index of the backslash.

String sms = "dev\project\lastdev\jfile.dll"

How do I do something like..

int l = sms.lastIndexOf("\")

Giving me -1. Which wrong

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194

1 Answers1

0

You need to escape the backslash like this:

int index = str.lastIndexOf("\\");

Check this for more info on characters of this kind.

Community
  • 1
  • 1
JackWhiteIII
  • 1,388
  • 2
  • 11
  • 25