code: public static String parseHostFromHostAndPort(String hostAndPort) {
          return hostAndPort.lastIndexOf(':') > 0 ? hostAndPort.substring(0, hostAndPort.lastIndexOf(':')) : hostAndPort;
      }
docs: Parse the hostname from a "hostname:port" formatted string
  
  @param hostAndPort
  @return