Get everything after the dash in a string in javascript

前端 未结 9 2047
故里飘歌
故里飘歌 2020-11-30 22:47

What would be the cleanest way of doing this that would work in both IE and firefox.

My string looks like this: sometext-20202

Now the \'sometext\' and the

9条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 23:19

    var testStr = "sometext-20202"
    var splitStr = testStr.substring(testStr.indexOf('-') + 1);
    

提交回复
热议问题