javascript string get substring after character code example
Example 1: javascript substring after character
// function you can use:
function getSecondPart(str) {
return str.split('-')[1];
}
// use the function:
alert(getSecondPart("sometext-20202"));
Example 2: javascript substring after character
var testStr = "sometext-20202"
var splitStr = testStr.substring(testStr.indexOf('-') + 1);