@Test public void testGetIcons() throws Exception { List<String> icons = FontIconUtil.getIcons(new File("D:\\me\\WEBT\\boco_6.3.4\\boco_moban\\css\\font-awesome.min.css")); StringBuilder builder = new StringBuilder(); builder.append("var icons = ["); for (int i = 0; i < icons.size(); i++) { String icon = icons.get(i); String simpleName = icon.substring(icon.indexOf("-") + 1); if (i < icons.size() - 1) { builder.append("'").append(simpleName).append("',"); } else { builder.append("'").append(simpleName).append("'"); } } builder.append("];"); System.out.println(builder.toString()); }
public static List<String> getIcons(File cssFile) { List<String> icons = new ArrayList<>(790); final String regex = ".(.*?):before\\s*\\{"; String curLine; BufferedReader reader; try { reader = new BufferedReader(new FileReader(cssFile)); while ((curLine = reader.readLine()) != null) { Matcher matcher = Pattern.compile(regex, Pattern.DOTALL | Pattern.MULTILINE).matcher(curLine); if (matcher.find()) { String selector = matcher.group(); if (selector.contains(",")) { String[] iconArr = selector.split(","); for (String str : iconArr) { icons.add(getIcon(str)); } } else { icons.add(getIcon(selector)); } } } } catch (Exception e) { e.printStackTrace(); } return icons; }
FontIconUtil { public static List<String> getIcons(File cssFile) { List<String> icons = new ArrayList<>(790); final String regex = ".(.*?):before\\s*\\{"; String curLine; BufferedReader reader; try { reader = new BufferedReader(new FileReader(cssFile)); while ((curLine = reader.readLine()) != null) { Matcher matcher = Pattern.compile(regex, Pattern.DOTALL | Pattern.MULTILINE).matcher(curLine); if (matcher.find()) { String selector = matcher.group(); if (selector.contains(",")) { String[] iconArr = selector.split(","); for (String str : iconArr) { icons.add(getIcon(str)); } } else { icons.add(getIcon(selector)); } } } } catch (Exception e) { e.printStackTrace(); } return icons; } }
FontIconUtil { public static List<String> getIcons(File cssFile) { List<String> icons = new ArrayList<>(790); final String regex = ".(.*?):before\\s*\\{"; String curLine; BufferedReader reader; try { reader = new BufferedReader(new FileReader(cssFile)); while ((curLine = reader.readLine()) != null) { Matcher matcher = Pattern.compile(regex, Pattern.DOTALL | Pattern.MULTILINE).matcher(curLine); if (matcher.find()) { String selector = matcher.group(); if (selector.contains(",")) { String[] iconArr = selector.split(","); for (String str : iconArr) { icons.add(getIcon(str)); } } else { icons.add(getIcon(selector)); } } } } catch (Exception e) { e.printStackTrace(); } return icons; }  }
FontIconUtil { public static List<String> getIcons(File cssFile) { List<String> icons = new ArrayList<>(790); final String regex = ".(.*?):before\\s*\\{"; String curLine; BufferedReader reader; try { reader = new BufferedReader(new FileReader(cssFile)); while ((curLine = reader.readLine()) != null) { Matcher matcher = Pattern.compile(regex, Pattern.DOTALL | Pattern.MULTILINE).matcher(curLine); if (matcher.find()) { String selector = matcher.group(); if (selector.contains(",")) { String[] iconArr = selector.split(","); for (String str : iconArr) { icons.add(getIcon(str)); } } else { icons.add(getIcon(selector)); } } } } catch (Exception e) { e.printStackTrace(); } return icons; }  static List<String> getIcons(File cssFile); }
FontIconUtil { public static List<String> getIcons(File cssFile) { List<String> icons = new ArrayList<>(790); final String regex = ".(.*?):before\\s*\\{"; String curLine; BufferedReader reader; try { reader = new BufferedReader(new FileReader(cssFile)); while ((curLine = reader.readLine()) != null) { Matcher matcher = Pattern.compile(regex, Pattern.DOTALL | Pattern.MULTILINE).matcher(curLine); if (matcher.find()) { String selector = matcher.group(); if (selector.contains(",")) { String[] iconArr = selector.split(","); for (String str : iconArr) { icons.add(getIcon(str)); } } else { icons.add(getIcon(selector)); } } } } catch (Exception e) { e.printStackTrace(); } return icons; }  static List<String> getIcons(File cssFile);  }