public static String parseHostname(final String hostAndPort) {
    int colonIndex = hostAndPort.lastIndexOf(HOSTNAME_PORT_SEPARATOR);
    if (colonIndex < 0) {
      throw new IllegalArgumentException("Not a host:port pair: " + hostAndPort);
    }
    return hostAndPort.substring(0, colonIndex);
  }
Parse the hostname portion of a host-and-port string
@param hostAndPort Formatted as <code>&lt;hostname&gt; ':' &lt;port&gt;</code>
@return The hostname portion of <code>hostAndPort</code>
hbase-common/src/main/java/org/apache/hadoop/hbase/util/Addressing.java