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/">文字列からand </string> aloneを削除する必要があり ます。どうやってやるの?

使ってみたstring.replace("","")

4

2 に答える 2

1

以下のコードを試してください。

yourstring = yourstring.replace(oldStringValue,newStringValue);

すなわち

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 に答える