Reputation: 113
I have a list containing the following:
String list[]={"Team 1,Apple,Mango,Kiwi","Team 2,Mango,Kiwi,Pineapple","Team 3,Kiwi,Pineapple,Apple"};
my question is, how do you know what each team has? also how do you get the team name?
i would like to have the output:
Team 1,Team 3(Apple,Kiwi)
Team 1,Team 2(Mango,Kiwi)
Team 2,Team 3(Pineapple,Kiwi)
can someone tell me what can be done or what to do?
Upvotes: 0
Views: 50
Reputation: 505
You can make use of StringTokenizer to accomplish your task.
http://developer.android.com/reference/java/util/StringTokenizer.html
Upvotes: 0
Reputation: 26
In order to get the values of the first string in a list of strings you can split the string by "," and put it in a list like following: String s1 [] = list[0].split(",");
and then s1[0] is Team1 s1[1] is Apple etc..
Upvotes: 1