Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

string split last slash in js get previous results

var str = "var1/var2/var3";

var rest = str.substring(0, str.lastIndexOf("/") + 1);
var last = str.substring(str.lastIndexOf("/") + 1, str.length);
console.log(rest);
console.log(last);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #string #split #slash #js #previous #results
ADD COMMENT
Topic
Name
1+2 =