Answers for "js split string at character take last"

2

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);
Posted by: Guest on October-06-2020
1

js split string every n characters

foo.match(new RegExp('.{1,' + n + '}', 'g'));
Posted by: Guest on August-23-2020

Code answers related to "js split string at character take last"

Code answers related to "Javascript"

Browse Popular Code Answers by Language