-4

How can I parse a string like success="true"&sign_type="RSA"&sign="xxx"

("" is included in the original string) into a Map or JavaBean?

Maveňツ
  • 1
  • 12
  • 50
  • 89
CrazyOrr
  • 307
  • 2
  • 3
  • 13

3 Answers3

2
Map<String, String> map = new HashMap<String, String>();
String[] arr = str.split("&");
for (String s : arr) {
    String[] a = s.split("=");
    map.put(a[0], a[1]);
}
lgdroid57
  • 699
  • 14
  • 29
HJK
  • 1,382
  • 2
  • 9
  • 19
0

Uri uri=Uri.parse(url_string); uri.getQueryParameter("RSA");

Klawikowski
  • 605
  • 3
  • 11
  • Please don't waste your time answering duplicate questions. Someone else with a new question may be loosing the chance to get your help. – rineez Apr 29 '15 at 06:47
-1

string.split(String regex) will be your friend here.

Manuel Jain
  • 751
  • 1
  • 6
  • 16