Use new split()

This commit is contained in:
zzz
2015-11-07 17:45:48 +00:00
parent 83b923151c
commit 1e5a35c7f8
31 changed files with 64 additions and 47 deletions

View File

@ -207,7 +207,7 @@ public class ConfigNetHelper extends HelperBase {
configs = Collections.emptySet();
} else {
configs = new HashSet<String>(4);
String[] ca = cs.split("[,; \r\n\t]");
String[] ca = DataHelper.split(cs, "[,; \r\n\t]");
for (int i = 0; i < ca.length; i++) {
String c = ca[i];
if (c.length() > 0) {

View File

@ -108,7 +108,7 @@ public class ConfigSummaryHandler extends FormHandler {
}
}
} else if (moving) {
String parts[] = _action.split("_");
String parts[] = DataHelper.split(_action, "_");
try {
int from = Integer.parseInt(parts[1]);
int to = 0;

View File

@ -202,7 +202,7 @@ public class EventLogHelper extends FormHandler {
buf.append(fmt.format(new Date(time)));
buf.append("</td><td>");
if (isAll) {
String[] s = event.split(" ", 2);
String[] s = DataHelper.split(event, " ", 2);
String xs = _xevents.get(s[0]);
if (xs == null)
xs = s[0];

View File

@ -135,8 +135,10 @@ public class HomeHelper extends HelperBase {
return renderConfig(apps);
}
private static final String SS = Character.toString(S);
static Collection<App> buildApps(RouterContext ctx, String config) {
String[] args = config.split("" + S);
String[] args = DataHelper.split(config, SS);
Set<App> apps = new TreeSet<App>(new AppComparator());
for (int i = 0; i < args.length - 3; i += 4) {
String name = Messages.getString(args[i], ctx);
@ -149,7 +151,7 @@ public class HomeHelper extends HelperBase {
}
static Collection<App> buildSearchApps(String config) {
String[] args = config.split("" + S);
String[] args = DataHelper.split(config, SS);
Set<App> apps = new TreeSet<App>(new AppComparator());
for (int i = 0; i < args.length - 1; i += 2) {
String name = args[i];

View File

@ -43,9 +43,11 @@ public class SearchHelper extends HelperBase {
_query = s;
}
private static final String SS = Character.toString(S);
private void buildEngineMap() {
String config = _context.getProperty(PROP_ENGINES, ENGINES_DEFAULT);
String[] args = config.split("" + S);
String[] args = DataHelper.split(config, SS);
for (int i = 0; i < args.length - 1; i += 2) {
String name = args[i];
String url = args[i+1];

View File

@ -861,6 +861,8 @@ public class SummaryHelper extends HelperBase {
public void storeNewsHelper(NewsHelper n) { _newshelper = n; }
public NewsHelper getNewsHelper() { return _newshelper; }
private static final String SS = Character.toString(S);
public List<String> getSummaryBarSections(String page) {
String config = "";
if ("home".equals(page)) {
@ -870,7 +872,7 @@ public class SummaryHelper extends HelperBase {
if (config == null)
config = _context.getProperty(PROP_SUMMARYBAR + "default", DEFAULT_FULL);
}
return Arrays.asList(config.split("" + S));
return Arrays.asList(DataHelper.split(config, SS));
}
static void saveSummaryBarSections(RouterContext ctx, String page, Map<Integer, String> sections) {