System.out.print(">");
str = ob.next();
str1 = ob.next();
String substr2[] = str.split(" ");
String substr[] = str1.split(",");
in_stone = Integer.parseInt(substr[0]);
ubound_stone = Integer.parseInt(substr[1]);
player1 = substr[2];
player2 = substr[3];
Output: User enters below..
gamestarts 10,4,U1,U2
player1 stores U1 and player2 stores U2
Now, I have a string array:
- List item
String tot_players_game = {"U1,H,B","U2,C,D","U3,E,F"};
I intent to first find U1 and U2 from above string array, then then store the values H,B,C,D as follows.
Name: H B C D
H = firstname, B = surname, U1 = username
What I intending to do is first search U1 stored in Player1 with tot_players_game. Once the string is found, fetch the complete string on that particular index and store in another string variable. Once this is done, will split this value into username, firstname and lastname. I am pretty confused whether to go for arraylist over here or string array? I need to play with this values, as I intent to delete these values as well from array or capture history of each username. Please suggest me the best possible method to implement this..