js 获取字符串中最后一个斜杠后面的内容:
var str = “/asdasf/asfaewf/agaegr/trer/rhh”;
var index = str .lastIndexOf("/");
str = str .substring(index + 1, str .length);
js 获取字符串中最后一个斜杠前面的内容:
var str = “/asdasf/asfaewf/agaegr/trer/rhh”;
var index = str .lastIndexOf("/");
str = str .substring(0, index+1);
本文转载,原文来源于:https://blog.csdn.net/qq_27467823/article/details/80900240