private bool IsGuid(string strToValidate) { bool isGuid = false; string strRegexPatten = @"^(/{){0,1}[0-9a-fA-F]{8}/-[0-9a-fA-F]{4}/" +@"-[0-9a-fA-F]{4}/-[0-9a-fA-F]{4}/-[0-9a-fA-F]{12}(/}){0,1}$"; if (strToValidate != null && !strToValidate.Equals("")) { isGuid =System.Text.RegularExpressions.Regex.IsMatch(strToValidate, strRegexPatten); } return isGuid; }
Technorati 标签: c# , guid , 函数