java吧 关注:1,290,066贴子:12,817,559
  • 15回复贴,共1

最好那个代码有什么用

只看楼主收藏回复

求解


IP属地:安徽来自iPhone客户端1楼2016-07-31 23:57回复
    求解啊


    IP属地:安徽来自iPhone客户端2楼2016-08-01 00:12
    回复
      2025-12-05 00:36:44
      广告
      不感兴趣
      开通SVIP免广告
      求解


      IP属地:安徽来自iPhone客户端3楼2016-08-01 00:12
      回复
        循环输出每个java单词的下标,最后一句就是当前下标加上java单词的长度就是过滤掉当前的单词,让下个循环往后读取匹配。


        IP属地:上海来自Android客户端5楼2016-08-01 00:28
        收起回复
          public int indexOf(String str, int fromIndex)Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
          The returned index is the smallest value k for which:
          k >= fromIndex && this.startsWith(str, k) If no such value of k exists, then -1 is returned.Parameters:str - the substring to search for.fromIndex - the index from which to start the search.Returns:the index of the first occurrence of the specified substring, starting at the specified index, or -1 if there is no such occurrence.


          IP属地:陕西7楼2016-08-01 00:31
          回复
            the index of the first occurrence of the specified substring, starting at the specified index, or -1 if there is no such occurrence.


            IP属地:陕西9楼2016-08-01 00:36
            收起回复
              str - the substring to search for.
              fromIndex - the index from which to start the search.


              IP属地:陕西10楼2016-08-01 00:36
              回复
                哈哈哈哈,连indexof的方法结构,都没得到,这选毛?


                来自iPhone客户端12楼2016-08-01 00:39
                收起回复
                  2025-12-05 00:30:44
                  广告
                  不感兴趣
                  开通SVIP免广告
                  第一圈,index=0, 则从str的0位置搜索与str1第一个匹配的位置, **java刚好是012;


                  IP属地:陕西13楼2016-08-01 00:41
                  收起回复
                    然后,index=str.indexOf(str1, index)=2;
                    接着 index+=str1.length()==index=index+str1.length=2+4=6;


                    IP属地:陕西14楼2016-08-01 00:44
                    收起回复