<script> | |
window.onload = function(s) { | |
var str="afdsghkdfsa"; | |
let strarr=[] | |
var len=0 | |
var x="" | |
for(var i=0;i<str.length;i++){ | |
let s=str[i] | |
var index=strarr.indexOf(s) | |
console.log(index) | |
if(index>=0) | |
strarr=strarr.slice(index+1) | |
strarr.push(s) | |
if(strarr.length>len) | |
{ | |
len=strarr.length | |
x=strarr.join("") | |
} | |
} | |
alert(x.length) | |
} | |
</script> |
js 子串
最新推荐文章于 2024-08-30 20:29:15 发布