javascript substring help

javascript, parsing, string, substring

Solution

Add 3 (the length of " - ") to the last index and leave off the second parameter. The default when you pass one parameter to substring is the go to the end of the string

var y = x.substring(x.lastIndexOf(" - ") + 3);

Problem

I have a string "2500 - SomeValue". How can I remove everything before the 'S' in 'SomeValue'? ``` var x = "2500 - SomeValue"; var y = x.substring(x.lastIndexOf(" - "), // this is where I'm stuck, I need the rest of the string starting from here. ``` Thanks for any help. ~ck

Original source