Hello i tried many ways to complete this but i failed. Could you help me ? I need double split one is "\n" and second is "|". In textArea is string 350|450\n 444|452\n and so one. There are mouse coordinates. X|Y in int array i need
array[0]= x coord;
array[1]= y coord;
array[2]= x coord;
array[2]= y coord;
So i have string in textarea.I split that by "\n"
String s[]= txtArea.getText().split("\\n");
This is one split and in textarea i have something like 150|255 this is my mouse coordinates x|y. So i need next split "|".
String s2[] = s[i].split("|");
After that
int [] array = new [s.length*2];
And some method for
while(!(s[j].equals("|")))
array[i] = Integer.parseInt(s[j]);
I tried something like that-
for(String line : txtArea.getText().split("\\n")){
arrayXY = line.split("\\|");
array = new int[arrayXY.length];
}
Thank you a lot for answers :) Have a nice day.