Hey everyone,
I am having some trouble parsing a string in java. I get a string from a databse, then I want to put it into a String Array to access two elements in the array (x and y positions). I think my problem is when I try to split the string. Any help would be much appreciated! Thanks!
//String From Database
result = result + c.getString(iRow) + " " + c.getString(iName) + " " + c.getString(iLocation) + "\n";
Example of this: "4 Mango Lane 42194221 -96010225 \n"
result = addSpot.getData();
String tempA[];
tempA = result.split(" ");
tempA = result.split("\n");
tempA = result.split(",");
String loc1,loc2;
for(int i = 3; i < tempA.length; i--) {
loc1 = tempA[i];
i++;
loc2 = tempA[i];
i+=5;
x = Integer.parseInt(loc1);
y = Integer.parseInt(loc2);