getCaption(obj, state,strname) { var index = obj.lastIndexOf(strname); if (state == 0) { obj = obj.substring(0, index); } else { obj = obj.substring(index + 1, obj.length); } return obj; }
//调用
getCaption('abcefefef/9jccdmcdcmdm',1,"/9j") //9jccdmcdcmdm 标签:字符,obj,9jccdmcdcmdm,index,截取,js,substring,state,strname From: https://www.cnblogs.com/Byme/p/17105111.html