下面的代码是将文本中的英文双引号改成中文双引号的方法:
话不多说,java代码奉上:
private static String processQuotationMarks(String content){
String regex = "\"([^\"]*)\"";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(content);
String reCT=content;
while(matcher.find()){
String itemMatch = "“" + matcher.group(1) + "”";
reCT=reCT.replace("\""+matcher.group(1)+"\"", itemMatch);
}
return reCT;
}