码迷,mamicode.com
首页 > Windows程序 > 详细

C# 检查是否为IP地址

时间:2017-08-09 19:08:53      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:str   检查   bool   c#   turn   string   static   地址   summary   

#region 检查是否为IP地址
/// <summary>
/// 是否为ip
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
public static bool IsIP(string ip)
{
return Regex.IsMatch(ip, @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$");
}
#endregion

C# 检查是否为IP地址

标签:str   检查   bool   c#   turn   string   static   地址   summary   

原文地址:http://www.cnblogs.com/yaoxiaozhong/p/7326991.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!