Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to remove a part of a string javascript

let string = "My name is Shumail";
let toBeRemove = "Shumail";
string = string.replace(tobeRemove,'');
Comment

javascript string remove substring

var string = "data-123";
string = string.replace('data-','');
alert(string)
Comment

remove part of string javascript

var str = "test_23";
alert(str.split("_").pop());
// -> 23
alert(str.split("_").shift());
// -> test

var str2 = "adifferenttest_153";
alert(str2.split("_").pop());
// -> 153
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to reade selected csv file data in node j s 
Javascript :: youtube set speed command 
Javascript :: js loader 
Javascript :: swap in javascript 
Javascript :: how to put react compnent to bottom 
Javascript :: diff in javascript 
Javascript :: call button click event in javascript 
Javascript :: javascript redirect with extra url arguments 
Javascript :: what is JSON TREE 
Javascript :: set input value vanilla js 
Javascript :: javascript get call stack 
Javascript :: regex usage 
Javascript :: react webpack config example 
Javascript :: .on click jquery 
Javascript :: javascript regex single line 
Javascript :: dayjs tostring 
Javascript :: react Refused to execute inline script because it violates the following Content Security Policy directive 
Javascript :: reset form input react 
Javascript :: fivem player json 
Javascript :: angular transition animation 
Javascript :: status 502 bad api gateway error solution for aws lambda 
Javascript :: print chart js 
Javascript :: disable button 
Javascript :: vue router guard 
Javascript :: editting collection in firebase firestore 
Javascript :: for of loop js 
Javascript :: javascript random number not decimal 
Javascript :: link in directive angularjs 
Javascript :: react native grid view 
Javascript :: jquery: select select box rpogramatically 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =