Reputation:
I have called webservice
from android and got a response as below.....
Result from WebService =
11-30 13:21:16.304: DEBUG/Inside SOAP(512): JSON output {
11-30 13:21:16.304: DEBUG/Inside SOAP(512): "_str": "anyType{string\u003dImplements and Equipments; string\u003dInsurance; string\u003dIrrigation and Water; }"
11-30 13:21:16.304: DEBUG/Inside SOAP(512): }
Now I want to parse these results and store in my SQLite
database. How it can be done? I need your help please...
Upvotes: 1
Views: 143
Reputation: 96
I'm assuming you want to get every string that follows an "=" and precedes a ";"
Here's a simple example:
// This is the string you want to parse
String searchableString = "string=first; string=second; string=third";
int indexOfEqualsSign = searchableString.indexOf("=");
int indexOfSemicolon = searchableString.indexOf(";");
while (indexOfEqualsSign >= 0) {
String result = searchableString.substring(indexOfEqualsSign + 1, indexOfSemicolon);
System.out.print(result);
indexOfEqualsSign = searchableString.indexOf("=", indexOfSemicolon);
}
The output of the example looks like this:
first
second
third
Upvotes: 3