C#获取真实IP地址实现方法

2019-12-26 12:16:57于丽

    {
        if ( str1 == null || str1 == string.Empty || str1.Length < 7 || str1.Length > 15 ) return false;
        string regformat = @"^d{1,3}[.]d{1,3}[.]d{1,3}[.]d{1,3}$";
        Regex regex = new Regex ( regformat, RegexOptions.IgnoreCase );
        return regex.IsMatch ( str1 );
    }
}
}

 

希望本文所述对大家的C#程序设计有所帮助。