1

我已经webservice从android打来电话并得到如下回复......

来自 Web 服务的结果 =

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): }

现在我想解析这些结果并存储在我的SQLite数据库中。怎么做?我需要你的帮助...

4

1 回答 1

3

我假设您想要获取“=”之后和“;”之前的每个字符串

这是一个简单的例子:

// 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);
}

该示例的输出如下所示:

first
second
third
于 2012-11-29T07:18:39.687 回答