我想要替换一个Java字符串的值,以下代码无法实现此功能。
什么是实现上述替换的最简单方法?
cleanInst.replaceAll("[<i>]", "");
cleanInst.replaceAll("[</i>]", "");
cleanInst.replaceAll("[//]", "/");
cleanInst.replaceAll("[\bPhysics Dept.\b]", "Physics Department");
cleanInst.replaceAll("[\b/n\b]", ";");
cleanInst.replaceAll("[\bDEPT\b]", "The Department");
cleanInst.replaceAll("[\bDEPT.\b]", "The Department");
cleanInst.replaceAll("[\bThe Dept.\b]", "The Department");
cleanInst.replaceAll("[\bthe dept.\b]", "The Department");
cleanInst.replaceAll("[\bThe Dept\b]", "The Department");
cleanInst.replaceAll("[\bthe dept\b]", "The Department");
cleanInst.replaceAll("[\bDept.\b]", "The Department");
cleanInst.replaceAll("[\bdept.\b]", "The Department");
cleanInst.replaceAll("[\bdept\b]", "The Department");
什么是实现上述替换的最简单方法?
[
和]
)。这些是字符类。如果还有其他问题,请提供更具体的信息。 - Reinstate Monica -- notmaynarddept
替换。 - IsaacString.replaceAll()
的返回值,那么您的代码将无法执行任何操作。目前,您的代码没有对返回值进行任何处理。 - jahroy