//题目:找出www.xx.com所有非空字串 var str = "www.xx.com", count = {}, i = 0; function cutstr(str,first,len){ if(first+len <= str.length){ while(first+len <= str.length){ var s = str.substr(first,len); first++; count[s]=0; } arguments.callee(str,0,++len); } } cutstr(str,0,1); for(var key in count){ console.log(++i); console.log(key); }
?可惜答题那天算错鸟,悲剧。