提交 d1303928 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Use String.replace(char, char) instead of StringUtils.replaceAll(String, String) where possible

上级 731abc26
...@@ -314,9 +314,9 @@ public class WebApp { ...@@ -314,9 +314,9 @@ public class WebApp {
value = space + value; value = space + value;
} }
key = StringUtils.urlEncode(key); key = StringUtils.urlEncode(key);
key = StringUtils.replaceAll(key, "+", " "); key = key.replace('+', ' ');
value = StringUtils.urlEncode(value); value = StringUtils.urlEncode(value);
value = StringUtils.replaceAll(value, "+", " "); value = value.replace('+', ' ');
list.add(type + "#" + key + "#" + value); list.add(type + "#" + key + "#" + value);
} }
Collections.sort(list); Collections.sort(list);
......
...@@ -247,7 +247,7 @@ class Database { ...@@ -247,7 +247,7 @@ class Database {
String key = (String) k; String key = (String) k;
if (key.startsWith(databaseType + ".")) { if (key.startsWith(databaseType + ".")) {
String pattern = key.substring(databaseType.length() + 1); String pattern = key.substring(databaseType.length() + 1);
pattern = StringUtils.replaceAll(pattern, "_", " "); pattern = pattern.replace('_', ' ');
pattern = StringUtils.toUpperEnglish(pattern); pattern = StringUtils.toUpperEnglish(pattern);
String replacement = prop.getProperty(key); String replacement = prop.getProperty(key);
replace.add(new String[]{pattern, replacement}); replace.add(new String[]{pattern, replacement});
......
...@@ -402,7 +402,7 @@ public class TestCsv extends TestBase { ...@@ -402,7 +402,7 @@ public class TestCsv extends TestBase {
InputStreamReader reader = new InputStreamReader( InputStreamReader reader = new InputStreamReader(
FileUtils.newInputStream(fileName)); FileUtils.newInputStream(fileName));
String text = IOUtils.readStringAndClose(reader, -1).trim(); String text = IOUtils.readStringAndClose(reader, -1).trim();
text = StringUtils.replaceAll(text, "\n", " "); text = text.replace('\n', ' ');
assertEquals("ID|NAME 1|Hello", text); assertEquals("ID|NAME 1|Hello", text);
ResultSet rs = stat.executeQuery("select * from csvread('" + ResultSet rs = stat.executeQuery("select * from csvread('" +
fileName + "', null, null, '|', '')"); fileName + "', null, null, '|', '')");
......
...@@ -176,9 +176,9 @@ public class GenerateDoc { ...@@ -176,9 +176,9 @@ public class GenerateDoc {
} }
String link = topic.toLowerCase(); String link = topic.toLowerCase();
link = StringUtils.replaceAll(link, " ", "_"); link = link.replace(' ', '_');
// link = StringUtils.replaceAll(link, "_", ""); // link = StringUtils.replaceAll(link, "_", "");
link = StringUtils.replaceAll(link, "@", "_"); link = link.replace('@', '_');
map.put("link", StringUtils.urlEncode(link)); map.put("link", StringUtils.urlEncode(link));
list.add(map); list.add(map);
......
...@@ -109,9 +109,9 @@ public class Railroads { ...@@ -109,9 +109,9 @@ public class Railroads {
} }
String link = topic.toLowerCase(); String link = topic.toLowerCase();
link = StringUtils.replaceAll(link, " ", "_"); link = link.replace(' ', '_');
// link = StringUtils.replaceAll(link, "_", ""); // link = StringUtils.replaceAll(link, "_", "");
link = StringUtils.replaceAll(link, "@", "_"); link = link.replace('@', '_');
map.put("link", StringUtils.urlEncode(link)); map.put("link", StringUtils.urlEncode(link));
list.add(map); list.add(map);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论