arrays - How to work with strings from a given java file? -


i'm starting learn java , i'm stuck one, lets have public class info in data there's id of player, first name , last name, league, , last number 1 = hitter , 2 = pitcher, in other 2 attributes hitters , pitchers performance 1st 1 player id , rest numbers calculations , stuff that's no issue.

private string[] data = {"30 juan perez yankees american 1",                            "43 pedro perez braves national 2",                           "31 carlos maldonado orioles national 1",                           "44 jose canseco phillips national 1",                           "45 jesus kilmer orioles national 2",                           "32 carlos montana braves national 2"};  private string[] hitters = {"30 50 10 3",                             "31 20 5 10",                             "44 60 10 10"};   private string[] pitchers = {"43 23.3 4 28",                               "45 50 2 10",                              "32 20 6 4"}; 

this practice test there other classes , stuff needed done , did part have work these values inside each string array don't know how , there's many stuff around don't know way go or best way it, know have split them , convert them in respective value work around values split part i'm stuck. sorry bothering y'all , in advance!

... in data there's id of player, first name , last name, league, , last number 1 = hitter , 2 = pitcher, in other 2 attributes hitters , pitchers performance 1st 1 player id , rest numbers calculations , stuff that's no issue.

for data (e.g. data[0]):

string [] info = data[0].split(" "); // split on space int playerid = integer.parseint(info[0]); string firstname = info[1]; string lastname = info[2]; // , on.. 

for more info on splitting strings, take @ this


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -