Answers for "javascript remove string after character"

9

how to remove lasr char from string in javascript

str=str.slice(0, -1);
Posted by: Guest on June-21-2020
0

js remove after character

url.split('?')[0]
Posted by: Guest on January-30-2021
1

javascript remove characters from beginning of string

// this will replace the first occurrence of "www." and return "testwww.com"
"www.testwww.com".replace("www.", "");

// this will slice the first four characters and return "testwww.com"
"www.testwww.com".slice(4);

// this will replace the www. only if it is at the beginning
"www.testwww.com".replace(/^(www\.)/,"");
Posted by: Guest on May-13-2020
-1

javascript str remove everything after character

var URL = "http://stackoverflow.com/questions/10767815/remove-everything-before-the-last-occurrence-of-a-character";
alert(URL.substring(0, URL.lastIndexOf("/") + 1));
Posted by: Guest on August-15-2021

Code answers related to "javascript remove string after character"

Code answers related to "Javascript"

Browse Popular Code Answers by Language