It uses regexp and is horribly slow, so use replace
where it works just as well.
}
Collections.sort(dictNames);
}
Collections.sort(dictNames);
- System.out.println(dictNames.toString().replaceAll(",", " *"));
+ System.out.println(dictNames.toString().replace(",", " *"));
dictionaryInfoOut.close();
}
dictionaryInfoOut.close();
}
}
public WikiTokenizer(String wikiText, final boolean isNewline) {
}
public WikiTokenizer(String wikiText, final boolean isNewline) {
- wikiText = wikiText.replaceAll("\u2028", "\n");
- wikiText = wikiText.replaceAll("\u0085", "\n");
+ wikiText = wikiText.replace('\u2028', '\n');
+ wikiText = wikiText.replace('\u0085', '\n');
this.wikiText = wikiText;
this.matcher = wikiTokenEvent.matcher(wikiText);
justReturnedNewline = isNewline;
this.wikiText = wikiText;
this.matcher = wikiTokenEvent.matcher(wikiText);
justReturnedNewline = isNewline;
return safeIndexOf(wikiText, start, "\n", "\n");
}
} else {
return safeIndexOf(wikiText, start, "\n", "\n");
}
} else {
- errors.add("Pop too many error: " + wikiText.substring(start).replaceAll("\n", "\\\\n"));
+ errors.add("Pop too many error: " + wikiText.substring(start).replace("\n", "\\\\n"));
// If we were looking for a newline
return safeIndexOf(wikiText, start, "\n", "\n");
}
// If we were looking for a newline
return safeIndexOf(wikiText, start, "\n", "\n");
}
while (s.endsWith("\n")) {
s = s.substring(0, s.length() - 1);
}
while (s.endsWith("\n")) {
s = s.substring(0, s.length() - 1);
}
- return s.replaceAll("\n", " ");
+ return s.replace('\n', ' ');
}
static int safeIndexOf(final String s, final int start, final String target, final String backup) {
}
static int safeIndexOf(final String s, final int start, final String target, final String backup) {
if (isIgnorableTitle(title)) {
return;
}
if (isIgnorableTitle(title)) {
return;
}
- final String lang = heading.replaceAll("=", "").trim();
+ final String lang = heading.replace("=", "").trim();
if (!langPattern.matcher(lang).find()){
return;
}
if (!langPattern.matcher(lang).find()){
return;
}
- } // ForeignParser
\ No newline at end of file
if (isIgnorableTitle(title)) {
return;
}
if (isIgnorableTitle(title)) {
return;
}
- heading = heading.replaceAll("=", "").trim();
+ heading = heading.replace("=", "").trim();
if (!heading.contains("English")) {
return;
}
if (!heading.contains("English")) {
return;
}
incrementCount("WARNING: Duplicate pair" );
}
}
incrementCount("WARNING: Duplicate pair" );
}
}
- } // EnToTranslationParser
\ No newline at end of file
+ } // EnToTranslationParser