var str = "/asdasf/asfaewf/agaegr/trer/rhh";function lastStr(str){ var index = str.lastIndexOf('\/'); str = str.substring(index + 1,str.length); return str; }