0

我从这样的网址获取字符串

<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("","")

4

2 回答 2

1

试试下面的代码。

yourstring = yourstring.replace(oldStringValue,newStringValue);

IE

yourstring = yourstring.replace("<string xmlns=\"http://tempuri.org/\">","");
于 2013-01-01T11:09:57.790 回答
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);
于 2013-01-01T11:17:15.690 回答