判断是否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;
            }
        }

posted on 2008-04-16 15:25  步走高飞  阅读(1152)  评论(2编辑  收藏  举报

导航