我从这样的网址中获取String
<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 :(得分:1)
请尝试以下代码。
yourstring = yourstring.replace(oldStringValue,newStringValue);
即
yourstring = yourstring.replace("<string xmlns=\"http://tempuri.org/\">","");
答案 1 :(得分: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);