How to return part of string before a certain character?

前端 未结 4 1333
谎友^
谎友^ 2020-12-08 18:49

If you look at the jsfiddle from question,

var str = \"Abc: Lorem ipsum sit amet\";
str = str.substring(str.indexOf(\":\") + 1);

This retur

4条回答
  •  感情败类
    2020-12-08 19:31

    Another method could be to split the string by ":" and then pop off the end. var newString = string.split(":").pop();

提交回复
热议问题