public class Utils { /** * @param hostStr * @return */ static public String parseHost(String hostStr) { int sepIdx = hostStr.indexOf(':'); if (sepIdx < 0) { return hostStr; } else { return hostStr.substring(0, sepIdx); } } }