Is there any way to get a map of java.awt.Point
s from a String? Or even just a single point on that String. For example for "xyz123\nabc123"
coordinate (0, 1)
would be 'a'
.
There is nothing built-in for that.
You can try and parse that string into a 2D char array or a vector of char arrays (depending on if you know how many lines in total or not).
Given "xyz123\nabc123" as str
:
//split it by newline, should work on windows/unix
String lines[] = str.split("\\r?\\n");
char[][] map = new char[lines.length][];
//fill up map, each row is a new line
for(int i = 0; i < lines.length; i ++)
map[i] = lines[i].toCharArray();
//map[0][2] returns 'z'