Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #part #string #javascript
ADD COMMENT
Topic
Name
5+2 =