0

I have this code:

    String a = "{action= some text, task= some text}, {action= some text2, task= some text2}";
    String[] b = a.split("\\{action\\=|\\,|\\}|task\\=");  
    for( String z : b){
        Log.e("eto", z);
    }

How do I store the text after "action=" which is some text to String action? same with task?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
user3325919
  • 45
  • 1
  • 7
  • I would not typically recommend Regular Expressions, but I think this is one of those cases where they would be quite useful. Unfortunately I don't have time to type out some proper (working) code, so I'll leave this as a comment for now. If it's not enough to get you started, I might post a full answer later. – CompuChip Mar 02 '14 at 10:34
  • duplication of same question by same user. - http://stackoverflow.com/questions/22125308/how-to-split-string-arraylist-hashmap – unknown Mar 02 '14 at 10:39
  • @CompuChip ok I will wait for your response :) – user3325919 Mar 02 '14 at 10:41

1 Answers1

0

Use StringTokenizer. Example included in link.

EDIT: You may need to use a couple of them, first one for comma separation than other for equals.

Dejan
  • 3,046
  • 3
  • 28
  • 43