字符串截取(某个指定字符)

Posted bingxiaoxiao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了字符串截取(某个指定字符)相关的知识,希望对你有一定的参考价值。

function getCaption(obj){
    var index=obj.lastIndexOf("\-");
    obj=obj.substring(index+1,obj.length);
    //  console.log(obj);
    return obj;
}
var str="字符串截取(某个指定字符之后)-zhangchenxiao";
getCaption(str);

打印:zhangchenxiao

以上是关于字符串截取(某个指定字符)的主要内容,如果未能解决你的问题,请参考以下文章