Gets the full instance id of the concatenation of hostname and the id. The dots in the hostname
replaced by underscores.

@param hostname the hostname
@param id the instance id
@return the full instance id of hostname[:id]
766453
private static String getFullInstanceId(String hostname, String id) {
    String str = hostname == null ? "" : hostname;
    str = str.replace('.', '_');
    str += (id == null ? "" : "-" + id);
    return str;
  }
374958
public OvhHostProfile location_pccZone_hostProfile_id_GET(String pccZone, Long id) throws IOException {
		String qPath = "/dedicatedCloud/location/{pccZone}/hostProfile/{id}";
		StringBuilder sb = path(qPath, pccZone, id);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhHostProfile.class);
	}
136152
def get_hostname(url):
        

        if url not in URLHelper.__cache:
            URLHelper.__cache[url] = urlparse(url)

        parts = URLHelper.__cache[url].netloc.split(".")

        if len(parts) == 1:
            return parts[0]
        else:
            return ".".join(parts[-2:-1])
1234821
private String[] splitHostNames(String hostNames)
    {
        String[] hostArray = hostNames.split(Constants.COMMA);
        String[] hosts = new String[hostArray.length];
        for (int i = 0; i < hostArray.length; i++)
        {
            hosts[i] = hostArray[i].trim();
        }
        return hosts;
    }
1289032
def _get_host(self, hostname):
        
        if hostname not in self.hosts:
            self.hosts[hostname] = {
                'groups': set(),
                'hostvars': {}
            }
        return self.hosts[hostname]
650448
public static boolean isIpv4(String hostName) {
		int periodCount = 0;
		int numberCount = 0;
		int lowerCount = 0;
		int upperCount = 0;
		int otherCount = 0;
		
		for(int i = 0; i < hostName.length(); i++ ) {
			char myChar = hostName.charAt(i);
			if (myChar=='.') {
				periodCount++;
			} else if (myChar >= '0' && myChar <= '9') {
				numberCount++;
			} else if (myChar >= 'a' & myChar <= 'z') {
				lowerCount++;
			} else if (myChar >= 'A' & myChar <= 'Z') {
				upperCount++;
			} else {
				otherCount++;
			}
		}
		
		if (periodCount==3 && numberCount >= 4 && lowerCount==0 && upperCount==0 && otherCount==0) {
			return true;
		} else {
			return false;
		}
	}
486141
public static String stripDomain(String hostname)
    {
        String ret = hostname;
        int pos = hostname.indexOf(".");
        if(pos != -1)
            ret = hostname.substring(0,pos);
        return ret;
    }
256840
protected String getHostBasedServiceCN(boolean last) {
        if (hostBasedServiceCN == null) {
            String dn = name.getName();

            int cnStart;

            if (last) {
                // use the last instance of CN in the DN
                cnStart = dn.lastIndexOf("CN=") + 3;
            } else {
                // use the first instance of CN in the DN
                cnStart = dn.indexOf("CN=") + 3;
            }

            if (cnStart == -1) {
                return null;
            }

            int cnEnd = dn.indexOf(",", cnStart);

            if (cnEnd == -1) {
                int nextAtt = dn.indexOf("=", cnStart);
                if (nextAtt == -1) {
                    // CN is the last attribute in the DN
                    cnEnd = dn.length();
                } else {
                    // unexpected DN format (attributes not comma delimited)
                    return null;
                }
            }

            hostBasedServiceCN = name.getName().substring(cnStart, cnEnd);
        }
        return hostBasedServiceCN;
    }
581703
public String toTableId(String tableName) {
    Preconditions.checkNotNull(tableName, "Table name cannot be null");
    String tablesPrefix = instanceName + TABLE_SEPARATOR;
    Preconditions.checkState(tableName.startsWith(tablesPrefix),
        "'%s' does not start with '%s'", tableName, tablesPrefix);
    String tableId = tableName.substring(tablesPrefix.length()).trim();
    Preconditions.checkState(!tableId.isEmpty(), "Table id is blank");
    return tableId;
  }
414423
def from_hostname(cls, hostname):
        """"""
        result = cls.list({'hostname': str(hostname)})
        if result:
            return result[0]['id']
1175655
public HostName toHostName() {
		HostName host = fromHost;
		if(host == null) {
			fromHost = host = toCanonicalHostName();
		}
		return host;
	}
531514
private String getHostHeaderForHost(String hostName) {
        List<ServerRedirect> servers = serverRedirectService.tableServers(requestInformation.get().client.getId());
        for (ServerRedirect server : servers) {
            if (server.getSrcUrl().compareTo(hostName) == 0) {
                String hostHeader = server.getHostHeader();
                if (hostHeader == null || hostHeader.length() == 0) {
                    return null;
                }
                return hostHeader;
            }
        }
        return null;
    }
5495
public static String extractUserName(final String hostname) {
        if (containsUserName(hostname)) {
            return hostname.substring(0, hostname.indexOf("@"));
        } else {
            return null;
        }
    }
712700
public java.lang.String getHostname() {
    java.lang.Object ref = hostname_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      if (bs.isValidUtf8()) {
        hostname_ = s;
      }
      return s;
    }
  }
983304
def get_name(self, host_name):
        
        if wildcard_match(self._pattern, host_name):
            return host_name
        else:
            return self._fallback
225333
public static UniAddress getByName( String hostname,
                                        boolean possibleNTDomainOrWorkgroup )
                                        throws UnknownHostException {
        UniAddress[] addrs = UniAddress.getAllByName(hostname, possibleNTDomainOrWorkgroup);
        return addrs[0];
    }
1102768
@Override
    protected String getInstanceIdName(int id)
    {
        int shifted = id - super.getMaxInstanceId();
        if (1 <= shifted && shifted <= MAX_INSTANCE_ID) {
            switch (shifted) {
                case Id_multiline:    return "multiline";
                case Id_STAR:         return "$*";

                case Id_input:        return "input";
                case Id_UNDERSCORE:   return "$_";

                case Id_lastMatch:    return "lastMatch";
                case Id_AMPERSAND:    return "$&";

                case Id_lastParen:    return "lastParen";
                case Id_PLUS:         return "$+";

                case Id_leftContext:  return "leftContext";
                case Id_BACK_QUOTE:   return "$`";

                case Id_rightContext: return "rightContext";
                case Id_QUOTE:        return "$'";
            }
            // Must be one of $1..$9, convert to 0..8
            int substring_number = shifted - DOLLAR_ID_BASE - 1;
            char[] buf = { '$', (char)('1' + substring_number) };
            return new String(buf);
        }
        return super.getInstanceIdName(id);
    }