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);
网友评论