[code:1:2936513c8b]var str = “var1/var2/var3”;
var rest = str.substring(0, str.lastIndexOf(“/”) + 1);
var last = str.substring(str.lastIndexOf(“/”) + 1, str.length);[/code:1:2936513c8b]
source:
http://jsfiddle.net/markcoleman/Haudj/1/
update:
[code:1:2936513c8b]str.split(’/’).pop() [/code:1:2936513c8b]
Source:
https://twitter.com/DannyvanKooten/status/668234111828406272
Leave a Reply