Search
 
SCRIPT & CODE EXAMPLE
 

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);
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery clear file input 
Javascript :: get parameter from the actual url javascript 
Javascript :: react image onerror 
Javascript :: Changing columns for table "users" requires Doctrine DBAL. Please install the doctrine/dbal package. 
Javascript :: react get current route 
Javascript :: count number of checkboxes in html jquery 
Javascript :: javascript get body element 
Javascript :: shopify json templates demo 
Javascript :: dconf-editor install 
Javascript :: autoplay owl carousel 
Javascript :: only letters and spaces regex 
Javascript :: jquery add contenteditable="true" 
Javascript :: ng has unexpectedly closed (exit code 127). 
Javascript :: download jquery 3.1.1 
Javascript :: jquery responsive 
Javascript :: Consider using the "jsdom" test environment. 
Javascript :: js loop every second 
Javascript :: javascript after time call function 
Javascript :: add id jquery 
Javascript :: jquery ajax basic authentication 
Javascript :: es module __dirname alternative 
Javascript :: disable right click jquery 
Javascript :: authfunctions react 
Javascript :: javascript wait for document load 
Javascript :: jquery on body click 
Javascript :: regex of date yyyy-mm-dd 
Javascript :: input will get only number vue 
Javascript :: select random element js array 
Javascript :: get text of selected option jquery 
Javascript :: npx for windows 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =