我正在编辑一些从 tesseract ocr 获得的电子邮件。
这是我的代码:
if (email != null) {
email = email.replaceAll(" ", "");
email = email.replaceAll("caneer", "career");
email = email.replaceAll("canaer", "career");
email = email.replaceAll("canear", "career");
email = email.replaceAll("caraer", "career");
email = email.replaceAll("carear", "career");
email = email.replace("|", "l");
email = email.replaceAll("}", "j");
email = email.replaceAll("j3b", "job");
email = email.replaceAll("gmaii.com", "gmail.com");
email = email.replaceAll("hotmaii.com", "hotmail.com");
email = email.replaceAll(".c0m", ".com");
email = email.replaceAll(".coin", ".com");
email = email.replaceAll("consuit", "consult");
}
return email;
但是输出不正确。
输入 :
amrut=ac.hrworks@g mai|.com
输出 :
lalcl.lhlrlwlolrlklsl@lglmlalil|l.lclolml
但是当我在每次替换后将结果分配给一个新字符串时,它工作正常。为什么同一字符串中的连续赋值不起作用?