public static string InvertHost(string host) { if (HostUtils.IsNumeric(host)) { return(host); } else { int n = host.Length; char[] res = new char[n]; int a = 0; while (a < n) { int c = a; while (c < n && host[c] != '.') { c++; } int d = n - c; while (a < c) { res[d++] = host[a++]; } res[d++] = '.'; a = c + 1; } return(new string(res)); } }
public static string InvertHost(string url) { int a = PrefixLength(url); int b = HostLength(url, a); return(url.Substring(0, a) + HostUtils.InvertHost(url.Substring(a, b)) + url.Substring(a + b)); }
public static string DomainOf(string url) { return(HostUtils.DomainOf(UrlUtils.HostOf(url))); }