看板 java 關於我們 聯絡資訊
這是我寫的到Amazon抓取Top-Reviewers的程式 http://paste.bradleygill.com/index.php?paste_id=21549 我的問題是在 public void NameToLink(int person)中的while迴圈 如果我寫 System.out.print( line ); 或者 System.out.print(line.substring(line.indexOf("#"+person))); 都可以在cmd下印出正確結果 但是我的目標是抓取Mark,Beth Cholette... 所以我改寫成 System.out.print(line.substring(line.lastIndexOf("#"+person), line.indexOf("</b>"))); 卻出現錯誤訊息 java.lang.StringIndexOutOfBoundsException: String index out of range: -6022 at java.lang.String.substring(Unknown Source) at RankAndLink.NameToLink(RankAndLink.java:115) at RankAndLink.main(RankAndLink.java:158) 我不知道哪裡寫錯了 可以教我如何修正嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.68.164.53
PsMonkey:你先 System.out.print(line.indexOf("</b>") 不就懂了? 09/29 12:21
chessjim:感謝萬分,Problem solved!! 09/29 13:50
PsMonkey:如果你下次還是同樣程度的文章,將會被視為作業文處理 09/29 15:03