Exemplo n.º 1
0
 public static String getImgStr(String htmlStr) {
   String imrUrl = "";
   if (StringUtil.isNull(htmlStr)) {
     return "";
   }
   Matcher matcher = PATTERN.matcher(htmlStr);
   List<String> list = new ArrayList<String>();
   while (matcher.find()) {
     String group = matcher.group(1);
     if (group == null) {
       continue;
     }
     if (group.startsWith("'")) {
       list.add(group.substring(1, group.indexOf("'", 1)));
     } else if (group.startsWith("\"")) {
       list.add(group.substring(1, group.indexOf("\"", 1)));
     } else {
       list.add(group.split("\\s")[0]);
     }
   }
   for (int i = 0; i < list.size(); i++) {
     if (list.size() == 1) {
       imrUrl = list.get(i);
     } else {
       imrUrl = imrUrl + list.get(i) + "$";
     }
   }
   return imrUrl;
 }
Exemplo n.º 2
0
 public static boolean isNumeric(String str) {
   if (StringUtil.isNull(str)) {
     return false;
   }
   for (int i = str.length(); --i >= 0; ) {
     int chr = str.charAt(i);
     if (chr < 48 || chr > 57) return false;
   }
   return true;
 }