How an I find LastIndexOf("\")

Dear Colleagues,

I am coding file upload form for our web.
I want to use LastIndexOf method to get a file name from  full path.
When I try to use LastIndexOf("\") it gives me an error.

Does anyone of you know how can I get an index of "\" from string.

Thanks in advance
Terrible_macroAsked:
Who is Participating?
 
ZvonkoConnect With a Mentor Systems architectCommented:
did you try:

yourString.lastIndexOf("\\");

0
 
brgivensCommented:
It might be as simple as changing the function name to lastIndexOf (LastIndexOf is not a JavaScript function).
0
 
ZvonkoSystems architectCommented:
The backslash is an escape character. So to place the escape character itself you have to double it.
0
 
Terrible_macroAuthor Commented:
Great Job Zvonko
0
 
ZvonkoSystems architectCommented:
Thanks for points :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.