2013-01-01 89 views
0

我得到的字符串從URL像這樣與其他價值

<string xmlns="http://tempuri.org/"> 
{"jewellery":{"Madurai":[{"id":"1","category":"Jewellery","type":"Silver","name":"Kallyan","banner":"","logo":"","about":"Kallyan Jewellery","contact":"Kallyan Jewellery","map":{"lat_long_1":{"latitude":"1.4875","longitude":"2.1547"}}},{"id":"2","category":"Jewellery","type":"Silver","name":"Kallayan Test","banner":"","logo":"","about":"Kallayan Test","contact":"Kallayan Test","map":{"lat_long_1":{"latitude":"24242","longitude":"2424"}}} ],"total":2} } 
</string> 

我需要從字符串中刪除<string xmlns="http://tempuri.org/"></string> 單獨替換字符串。我怎樣才能做到這一點?

我嘗試使用string.replace("","")

+0

發生了什麼事,你使用後'與string.replace( 「」, 「」 );'打破懸念... – Renjith

回答

1

嘗試下面的代碼。

yourstring = yourstring.replace(oldStringValue,newStringValue); 

yourstring = yourstring.replace("<string xmlns=\"http://tempuri.org/\">",""); 
+0

雅我知道了,它的工作Thanku @ V.J。 –

+0

@AmarnathK如果你對了,你爲什麼不喜歡它?它會幫助別人。 – Darpan

+0

@AmarnathK如果我的回答會幫助你。那麼請接受它... –

0
String url =your string i.e. //<string xmlns="http://tempuri.org/">{"jewellery":{"Madurai":[{"id":"1","category":"Jewellery","type":"Silver","name":"Kallyan","banner":"","logo":"","about":"Kallyan Jewellery","contact":"Kallyan Jewellery","map":{"lat_long_1":{"latitude":"1.4875","longitude":"2.1547"}}},{"id":"2","category":"Jewellery","type":"Silver","name":"Kallayan Test","banner":"","logo":"","about":"Kallayan Test","contact":"Kallayan Test","map":{"lat_long_1":{"latitude":"24242","longitude":"2424"}}} ],"total":2} } 

String suburl = url.substring(startpoint, endpoint); 

在你的情況

String suburl = url.substring(37, 493);