using System.Text.RegularExpressions; namespace PLCSharp.Core.Tools { /// /// StringExtension /// public static class StringExtension { /// /// IsIP /// /// ip /// 返回布尔值 public static bool IsIP(this string ip) { return Regex.IsMatch(ip, @"^(0|[1-9]\d?|1\d{2}|2[0-4]\d|25[0-5])(\.(0|[1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])){3}$"); } } }