JS => subString字符串截取(获取指定字符后面的所有字符内容)

514 阅读1分钟
// JS字符串截取(获取指定字符后面的所有字符内容)
function getSub (obj){
    let index = obj.lastIndexOf('\/')
    obj = obj.substring(index+1, obj.length)
    return obj
}
let str ='https://www.cnblogs.com/liumengdie/p/7908393.html'
getSub(str)
console.log(getSub(str)) // 7908393.html