src/packages/EmbedIO/Utilities/IPParser.cs
/// <summary>
/// Determines whether the IP-range string is in CIDR notation.
/// </summary>
/// <param name="range">The IP-range string.</param>
/// <returns>
///   <c>true</c> if the IP-range string is CIDR notation; otherwise, <c>false</c>.
/// </returns>
Determines whether the IP-range string is in CIDR notation.
Determines whether the IP - range string is in CIDR notation .
public static bool IsCidrNotation(string range)
        {
            if (string.IsNullOrWhiteSpace(range))
                return false;
            var parts = range.Split('/');
            if (parts.Length != 2)
                return false;
            var prefix = parts[0];
            var prefixLen = parts[1];
            var prefixParts = prefix.Split('.');
            if (prefixParts.Length != 4)
                return false;
            return byte.TryParse(prefixLen, out var len) && len <= 32;
        }
public static bool IsCidrNotation ( string range ) { if ( string . IsNullOrWhiteSpace ( range ) ) return false ; var parts = range . Split ( ' ' ) ; if ( parts . Length != 2 ) return false ; var prefix = parts [ 0 ] ; var prefixLen = parts [ 1 ] ; var prefixParts = prefix . Split ( ' ' ) ; if ( prefixParts . Length != 4 ) return false ; return byte . TryParse ( prefixLen , out var len ) && len <= 32 ; }
Determines whether the IP-range string is in CIDR notation.
Determines whether the IP - range string is in CIDR notation .
None
range
string
The IP-range string.
The IP - range string .