public boolean hasProtocolName(String url){
  int index=url.indexOf(':');
  if (index <= 0) {
    return false;
  }
  for (int i=0; i < index; i++) {
    char c=url.charAt(i);
    if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c == '-')) {
      continue;
    }
    return false;
  }
  return true;
}

public boolean hasProtocolName ( String url ) { int index = url . indexOf ( ':' ) ; if ( index <= 0 ) { return false ; } for ( int i = 0 ; i < index ; i ++ ) { char c = url . charAt ( i ) ; if ( ( c >= 'A' && c <= 'Z' ) || ( c >= 'a' && c <= 'z' ) || ( c == '-' ) ) { continue ; } return false ; } return true ; }
given a possibly abbreviated url , this predicate function returns true if it appears that the url contains a protocol name
