2011-03-09 59 views
0

我有這樣一行文字:的Android HTTPGET

id:1234 dateandtime: 03/10/2011 14:30 firstnumber:2222 secondnumber:3333 centernumber: 4444 
refrancenumber:5555 webaddress: www.example.com 

而且我使用此代碼讀取它關閉我的網站,我有測試

//Encode and set entity 
postMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.UTF_8)); 
//Execute and get the response - remove all html tag 
addressString = hc.execute(postMethod, res).replaceAll("<(.|\n)*?>",""); 

我的問題是,這個代碼把它讀成一個段落我想將它們分開,所以我可以將它們中的每一個在自己的列在SQLite數據庫。

注:123403/10/2011 14:302222333344445555www.example.com每個將被存儲在一個單獨的源碼柱。

有什麼建議嗎?

+0

我推薦使用JSON結構。 – Olsavage 2011-03-09 16:29:04

回答

0

我建議閱讀有關String.split(String regularExpression)功能:documentation

+0

非常感謝您的幫助,但有沒有關於如何使用一個例子String.split(字符串正則表達式)功能 – Moe 2011-03-10 03:50:57

+0

@Moe:你既可以讀出我已經在我的答案鏈接的文檔,或者你可以從這裏開始:HTTP: //www.google.com/search?q=android+string+split+example – Nailuj 2011-03-10 09:53:02