JS反向截取字符串

var t_license_attachment = “aaaaaaaaaaaaa/abb/bb.txt”;

var attachmentTitle = "";
 var arr = new Array();
 arr = t_license_attachment.split("/");
 if(arr.length > 1){ 

//从后面截取第一个/号,并取出值
   attachmentTitle = arr[arr.length - 1].substring(0);
 }

 

你可能感兴趣的:(JS反向截取字符串)