我需要通过使用单独的 2D 中列出的搜索和替换匹配array
项来搜索和替换。strings
array
- - - - 编辑 - - - -
最终代码:
String[][] searchLibrary; // calls the replaces array from the LibToArray method
searchLibrary= LibToArray();
for(int i = 0; i <searchLibrary.length; i++){
{
fileContents.set(i, fileContents.get(i).replace(searchLibrary[i][0], searchLibrary[i][1]));
}
}
for (String row : fileContents) {
System.out.println(row); // print array to cmd
}