Java 将输入的字符串保存到二维数组中

Java 将输入的字符串保存到二维数组中,java,multidimensional-array,Java,Multidimensional Array,我需要一些帮助,我不知道这里的错误是从哪里来的。。 我需要将输入字符串的每个字符保存在2D数组中。我还输入了行和列编号以及水平和垂直方向。在此基础上,我使用charAt计算了字符串的每个字符,并根据输入的行数和列数将其保存在数组中的特定位置。。 这是我的密码 playedword = word.getText().toString(); evalrow = Integer.parseInt(inrow.getText().toString()); evalcolumn = Integer.par

我需要一些帮助,我不知道这里的错误是从哪里来的。。 我需要将输入字符串的每个字符保存在2D数组中。我还输入了行和列编号以及水平和垂直方向。在此基础上,我使用
charAt
计算了字符串的每个字符,并根据输入的行数和列数将其保存在数组中的特定位置。。 这是我的密码

playedword = word.getText().toString();
evalrow = Integer.parseInt(inrow.getText().toString());
evalcolumn = Integer.parseInt(incolumn.getText().toString());
evalorient = inorient.getText().toString();

if(evalorient.equals("H")){
    orientation=0; //horizontal
}
else if(evalorient.equals("V")){
    orentation=1; //vertical
}

if(playedword.length()>0){
    if(vertical == 0){
        for(int u=0; u<playedword.length(); u++){
            arr2[evalrow][evalcolumn+u] = playedword.charAt(u);
        }
    }
    else if(vertical == 1){
        for(int u=0; u<playedword.length(); u++){
            arr2[evalrow+u][evalcolumn] = playedword.charAt(u);
        }
    }
}
playedword=word.getText().toString();
evalrow=Integer.parseInt(inrow.getText().toString());
evalcolumn=Integer.parseInt(incolumn.getText().toString());
evalorient=inorient.getText().toString();
如果(evalorient.等于(“H”)){
方向=0;//水平
}
else如果(evalorient.等于(“V”)){
orentation=1;//垂直
}
如果(playedword.length()>0){
如果(垂直==0){

对于(int u=0;u,对于从字符串到二维数组的转换,请尝试以下逻辑

char[][] array = new char[5][5];
String str="hello how are you my dear";
for (int i = 0; i < 5; ++i)
{
  str.getChars(i*5, (i*5)+5, array[i], 0);    // str is the 25-char string
}
char[][]数组=新字符[5][5];
String str=“你好,亲爱的”;
对于(int i=0;i<5;++i)
{
str.getChars(i*5,(i*5)+5,数组[i],0);//str是25个字符的字符串
}

@kathy您可以发布程序中断时收到的错误消息吗?应该类似于“回溯(最近一次调用):文件“tb.py”,第10行,在a()中”