I start with an array of strings formatted useful.useless. I need to trim out the .useless part, and then put the useful part in a 2D char array.
I see a way that involves creating a second string array containing only the useful part, and then converting that to a 2D char array, but there is probably a more effective way.
However, I don't know how to convert string array to 2D char array
public static void main (String[]args){
// this here is just to create an array so the example runs
String in = "useful1.useless1,useful2.useless2,useful3.useless3,";
String[] strArray = null;
strArray = in.split(",");
/*the array of strings is thus
[useful1.useless1, useful2.useless2, useful3.useless3]
*/
char [][] charArray = new char [strArray.length][];
/* trim from the . so only useful part remains
then put in 2d char array, which should look like
[u,s,e,f,u,l,1]
[u,s,e,f,u,l,2]
[u,s,e,f,u,l,3]
the array will be a ragged array
*/
}
.: stackoverflow.com/questions/12277461/…