code: public static String stripDomain(String hostname)
      {
          String ret = hostname;
          int pos = hostname.indexOf(".");
          if(pos != -1)
              ret = hostname.substring(0,pos);
          return ret;
      }
docs: Returns the given hostname with the domain removed.
  @param hostname The hostname to be converted
  @return The hostname with the domain removed