Answers for "javascript substring after character"

4

get string after character javascript

const str = '01-01-2020';

// get everything after first dash
const slug = str.substring(str.indexOf('-') + 1); // 01-2020

// get everything after last dash 
const slug = str.split('-').pop(); // 2020
Posted by: Guest on July-06-2020
2

remove first 3 characters from string javascript

var string = "abcd";
console.log(string.substring(3)); //"d"
Posted by: Guest on December-13-2019
1

get everything after the first character javascript

var val = 'asdasd:111122:123123123';
var response = val.substring(val.indexOf(":"));

alert(response); // ":111122:123123123"
Posted by: Guest on September-16-2020
0

javascript substring after character

var testStr = "sometext-20202"
var splitStr = testStr.substring(testStr.indexOf('-') + 1);
Posted by: Guest on February-12-2021
0

javascript substring after character

// function you can use:
function getSecondPart(str) {
    return str.split('-')[1];
}
// use the function:
alert(getSecondPart("sometext-20202"));
Posted by: Guest on February-12-2021
0

javascript substring after character

const str = 'sometext-20202';
const slug = str.split('-').pop();
Posted by: Guest on February-12-2021

Code answers related to "javascript substring after character"

Code answers related to "Javascript"

Browse Popular Code Answers by Language