Find is string is present in string Strip out everything in string after a defined string
url = 'my-string';
substring = "string";
console.log(url.indexOf(substring) !== -1); //will return true is string is present
var output = url.split('string-to-remove')[0]; // will strip out everything in string after
console.log(output);