用split替代StringTokenizer

当经常使用特殊字符分割时,在使用StringTokenizer和使用 split中进行考虑时,应使用split,StringTokenizer是遗留方法,为了支持较早版本。

StringTokenizer tok = new StringTokenizer(jdbcDrivers, ",");
while (tok.hasMoreTokens()) {
String jdbcDriver = tok.nextToken();
if (loadedDrivers.add(jdbcDriver)) {
try {
Class.forName(jdbcDriver);
LOGGER.info(
"Mondrian: JDBC driver "
+ jdbcDriver + " loaded successfully");
} catch (ClassNotFoundException e) {
LOGGER.warn(
"Mondrian: Warning: JDBC driver "
+ jdbcDriver + " not found");
}
}
}
}

你可能感兴趣的:(jdbc)