Ejemplo n.º 1
0
 public static boolean hasURL(String msg) {
   if (null == msg) return false;
   Vector<String> result = new Vector<String>();
   parseForUrl(result, msg, '.', URL_CHAR_PREV, URL_CHAR_OTHER, 1);
   parseForUrl(result, msg, ':', URL_CHAR_PROTOCOL, URL_CHAR_OTHER, 1);
   parseForUrl(result, msg, '+', URL_CHAR_NONE, URL_CHAR_DIGIT, 1);
   parseForUrl(result, msg, '@', URL_CHAR_PREV, URL_CHAR_OTHER, 1);
   return !result.isEmpty();
 }
Ejemplo n.º 2
0
 public static Vector parseMessageForURL(String msg) {
   if (null == msg) return null;
   // we are parsing 100 links only
   final int MAX_LINK_COUNT = 100;
   Vector<String> result = new Vector<String>();
   parseForUrl(result, msg, '.', URL_CHAR_PREV, URL_CHAR_OTHER, MAX_LINK_COUNT);
   parseForUrl(result, msg, ':', URL_CHAR_PROTOCOL, URL_CHAR_OTHER, MAX_LINK_COUNT);
   parseForUrl(result, msg, '+', URL_CHAR_NONE, URL_CHAR_DIGIT, MAX_LINK_COUNT);
   parseForUrl(result, msg, '@', URL_CHAR_PREV, URL_CHAR_OTHER, MAX_LINK_COUNT);
   return result.isEmpty() ? null : result;
 }