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

Inline StringUtils.startsWithIgnoreCase() and use regionMatches() instead of substring()

上级 4f64bcd2
...@@ -1420,7 +1420,8 @@ public class WebApp { ...@@ -1420,7 +1420,8 @@ public class WebApp {
} }
private static boolean isBuiltIn(String sql, String builtIn) { private static boolean isBuiltIn(String sql, String builtIn) {
return StringUtils.startsWithIgnoreCase(sql, builtIn); int len = builtIn.length();
return sql.length() >= len && sql.regionMatches(true, 0, builtIn, 0, len);
} }
private String executeLoop(Connection conn, int count, String sql) private String executeLoop(Connection conn, int count, String sql)
......
...@@ -110,20 +110,6 @@ public class StringUtils { ...@@ -110,20 +110,6 @@ public class StringUtils {
return s.toLowerCase(Locale.ENGLISH); return s.toLowerCase(Locale.ENGLISH);
} }
/**
* Check is a string starts with another string, ignoring the case.
*
* @param s the string to check (must be longer than start)
* @param start the prefix of s
* @return true if start is a prefix of s
*/
public static boolean startsWithIgnoreCase(String s, String start) {
if (s.length() < start.length()) {
return false;
}
return s.substring(0, start.length()).equalsIgnoreCase(start);
}
/** /**
* Convert a string to a SQL literal. Null is converted to NULL. The text is * Convert a string to a SQL literal. Null is converted to NULL. The text is
* enclosed in single quotes. If there are any special characters, the * enclosed in single quotes. If there are any special characters, the
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论