开发者

getting name value pairs(in decoded format) from the posted form

we are working on developing plugin for k9-email client for android os... i want to get the name value pairs back in the decodedd format from the posted form..

when i open the mail after clicking "show original" on gmail then following is displayed...like..

input name=3D"DefaultZDM" value=3D"https://voltage-pp-0000.july.co=
m/zdr" type=3D"hidden">
        input name=3D"ZFRDesignatedRecipient" value=3D"daphnebarretto@gmai=
l.com" type=3D"hidden">
        div style=3D"width: 1px; max-width: 1px; min-height: 1px; max-heig=
ht: 1px; overflow: hidden; padding: 5px;">
       开发者_运维问答     pre style=3D"width: 1px; max-width: 1px; min-height: 1px; max-=
height: 1px; overflow: hidden; padding: 5px;">               =20
-----BEGIN VOLTAGE SECURE BLOCK V2-----
pt7tH1g22PVBtplPHn6zQgtRS2LFWbVavN5ZMOWs+S/x5OiPmWNy+Na8Xek9ICpE
3cm5xa5dIYvgYiYLbk8C0CuTd6koONPGs2IH2IQhm32phDpafXoa/1n3xOcfuuSB
v79H3sWZtW7EKy2hblpKi+0Y9KOZvpaL7nSd6tz9EVrA7XBa9nM1fvpBWvOsWIkA
VeYgMgjMFpLOVsastOqj3eJW7Jp+u4cm5n8PWAI4T9YuETtP/waOvYF8TAMI8Vey
3y09ZmJ2BS9VLhPKMJHSod6cYeSbD1gRwPoVp+AybnKz+BeBzd2DjBHS+sbd7/Va
Gn1beoCwfdPAteYxWcFShb6Sznw7whlZDyDnwtCwqrcHOpHIYkzXp4N5/4qzUzof
/QyBRY35rSciihyKqdo=3D
-----END VOLTAGE SECURE BLOCK V2-----

            </pre>
        </div>
    </font>
</td></tr>
</tbody></table>
    =20
</div>
</div>

from the above, input tags, i want to get the DefaultZDM="https://voltage-pp-0000.july.com/zdr" and ZFRDesignatedRecipient="daphnebarretto@gmail.com"

thank you..


One idea would be to use a regular expression to find your matches. Below is an example of how to use a regular expression to break a string at 160 characters, but you could easily modify it with:

Pattern p = Pattern.compile("DefaultZDM\" value=3D\"(.*)\"|ZFRDesignatedRecipient\" value=3D\"(.*)\""

I'm certain I do NOT have that pattern correct, but it's a start. That would match your desired value pairs and you could assign them to variables in your code.

protected ArrayList<String> splitMsg(SmsMessage smsMessage) {
        ArrayList<String> smt;
        Pattern p = Pattern.compile(".{1,160}");
        Matcher regexMatcher = p.matcher(smsMessage.getMsgBody());
        smt = new ArrayList<String>();
        while (regexMatcher.find()) {
            smt.add(regexMatcher.group());
        }
        return smt;
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜