判断是否GUID
public bool IsGUID(string str)
{
Match m = Regex.Match(str, @"^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$", RegexOptions.IgnoreCase);
if (m.Success)
{
//可以转换
//Guid guid = new Guid(str);
return true;
}
else
{
//不可转换
return false;
}
}
{
Match m = Regex.Match(str, @"^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$", RegexOptions.IgnoreCase);
if (m.Success)
{
//可以转换
//Guid guid = new Guid(str);
return true;
}
else
{
//不可转换
return false;
}
}