可能重複替換斜線:
Hints for java.lang.String.replace problem?
Using string.replace() in Java如何使用下劃線
爲什麼 「/」 不通過 「_」 代替?
public static void main(String[] args) throws IOException {
String file = "A/B";
file.replaceAll("/", "_");
System.out.println(file);
}
此外,當你需要的是'replace'不使用'replaceAll'。這只是要求麻煩。 –