System.DomainNameHelper.ParseCanonicalName C# (CSharp) Method

ParseCanonicalName() static private method

static private ParseCanonicalName ( string str, int start, int end, bool &loopback ) : string
str string
start int
end int
loopback bool
return string
        internal static string ParseCanonicalName(string str,int start, int end, ref bool loopback) {
            string res = null;

            for (int i = end-1; i >= start; --i) {
                if (str[i] >= 'A' && str[i] <= 'Z') {
                    res = str.Substring(start, end-start).ToLower(CultureInfo.InvariantCulture);
                    break;
                }
                if (str[i] == ':')
                    end = i;
            }

            if (res == null) {
                res = str.Substring(start, end-start);
            }

            if (res == Localhost || res == Loopback) {
                loopback = true;
                return Localhost;
            }
            return res;
        }
        //

Usage Example

        // properties

        // methods
        internal static string ParseCanonicalName(string str, int start, int end, ref bool loopback)
        {
            return(DomainNameHelper.ParseCanonicalName(str, start, end, ref loopback));
        }