18
rated 0 times
[
22]
[
4]
/ answers: 1 / hits: 26991
/ 10 Years ago, fri, august 15, 2014, 12:00:00
I am trying to figure out how to get the second to last index of a character in a string.
For example, I have a string like so:
http://www.example.com/website/projects/2
I currently get the number 2
by using
$(location).attr('href').substring($(location).attr('href').lastIndexOf('/')+1);
But what if I want to get the word projects
?
Can anybody help me out with this? Thanks in advance!
More From » javascript