[J2SE] html的文字能當成string用嗎?
http://udn.com/NEWS/WORLD/WOR1/3804335.shtml
以上是我要截取的網頁
我在前面先宣告
String endString = "聯合報";
截取時
while ((lineStr=in.readLine())!= null )
{ if(lineStr.equals(endString))
break;
testStr=testStr.replaceAll("<[^>]*>","");
testStr=testStr.replaceAll(" ","");
}
原本的用意是我是只想要截取新聞~避免掉其他的html碼,
讓他讀到新聞結尾的聯合報就跳出
但是這樣的做法好像行不通
有人可以指點一下嗎?謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.57.128.92
討論串 (同標題文章)
以下文章回應了本文 (最舊先):
完整討論串 (本文為第 1 之 5 篇):