我这里有两个字符数组,我的目标是得到两个数组的变化并形成一串单词。这个想法就像在拼字游戏中获取新玩过的单词,其中我还需要考虑我之前使用的字符字。(我说清楚了吗?)。我的问题是,我可以得到 OST 但不能得到 P ......请帮助......
这是我的代码
Character[][] arr1 = new Character[4][4];
arr1[0][0] = 'H';
arr1[0][1] = 'E';
arr1[0][2] = 'L';
arr1[0][3] = 'P';
arr1[1][0] = ' ';
arr1[1][2] = ' ';
arr1[1][3] = ' ';
arr1[2][0] = ' ';
arr1[2][1] = ' ';
arr1[2][2] = ' ';
arr1[2][3] = ' ';
arr1[3][0] = ' ';
arr1[3][1] = ' ';
arr1[3][2] = ' ';
arr1[3][3] = ' ';
Character[][] arr2 = new Character[4][4];
arr2[0][0] = 'H';
arr2[0][1] = 'E';
arr2[0][2] = 'L';
arr2[0][3] = 'P';
arr2[1][0] = ' ';
arr2[1][2] = ' ';
arr2[1][3] = 'O';
arr2[2][0] = ' ';
arr2[2][1] = ' ';
arr2[2][2] = ' ';
arr2[2][3] = 'S';
arr2[3][0] = ' ';
arr2[3][1] = ' ';
arr2[3][2] = ' ';
arr2[3][3] = 'T';
for(i=0;i<4;i++){
for(j=0;j<4;j++){
if(arr1[i][j]!=arr2[i][j]){
s = arr2[i][j];
t = Character.toString(s);
out = builder.append(t).toString();
}
}
}
ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
output.setText(out);
}
});
提前致谢...