By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,353 Members | 1,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,353 IT Pros & Developers. It's quick & easy.

Is there a way to test guid string?

P: n/a
Is there a way to test guid string?

I want to do it without try catch block to save on performance.

Thanks in advance.
--

SevDer
http://www.sevder.com
A new source for .NET Developers

Jan 26 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
SevDer,

What do you mean exactly? To test what?

--

Stoitcho Goutsev (100)

"SevDer" <se****@newsgroup.nospam> wrote in message
news:eh**************@tk2msftngp13.phx.gbl...
Is there a way to test guid string?

I want to do it without try catch block to save on performance.

Thanks in advance.
--

SevDer
http://www.sevder.com
A new source for .NET Developers

Jan 26 '06 #2

P: n/a
SevDer <se****@newsgroup.nospam> wrote:
Is there a way to test guid string?
To test whether a given string is really a GUID? Check that there are
hyphens in all the right places and that the rest of the characters are
in the range 0-9, a-f, A-F. I think that should do it.
I want to do it without try catch block to save on performance.


How many non-GUIDs are you expecting to see? Have you seen what the
*actual* performance impact is? Many people shy away from using
exceptions due to myths about their performance. See
http://www.pobox.com/~skeet/csharp/exceptions.html

Now, if you'd said "because this isn't an exceptional situation, and
I'm validating input data" that would be a much better reason not to
use exceptions.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 26 '06 #3

P: n/a
"SevDer" <se****@newsgroup.nospam> wrote in news:eh**************@tk2msftngp13.phx.gbl:
Is there a way to test guid string?

I want to do it without try catch block to save on performance.

Thanks in advance.


I concur w/ Jon. In fact, digging around MSDN turned up a regex
pattern you can use to validate a GUID:

[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}

from

http://msdn2.microsoft.com/en-us/lib...US,VS.80).aspx
--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Jan 27 '06 #4

P: n/a
Hi Sev,
Welcome to MSDN Newsgroup!

Based on the current situation, please help me confirm what's the meaning
of "test GUID string"? If you want to test whether or not the GUID string
is valid, I agree with Chris's comment and suggest you could use regular
expression to achieve this goal.

I hope the above information is helpful for you. If you have any questions,
please feel free to let me know. Thanks and have a nice day!

Best Regards,

Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security

--------------------
Reply-To: "SevDer" <se******@sevder.com>
From: "SevDer" <se****@newsgroup.nospam>
Subject: Is there a way to test guid string?
Date: Thu, 26 Jan 2006 17:48:19 -0500
Lines: 15
Organization: http://www.sevder.com
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
Message-ID: <eh**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.csharp
NNTP-Posting-Host: mail.dtfares.com 68.167.20.2
Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.languages.csharp:381559
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

Is there a way to test guid string?

I want to do it without try catch block to save on performance.

Thanks in advance.
--

SevDer
http://www.sevder.com
A new source for .NET Developers


Jan 27 '06 #5

P: n/a
Thanks everybody for your valuable time and comments.
I actually wanted to know if there is a built in method to do that, but
RegEx works for me.

Regards to all

--

SevDer
http://www.sevder.com
A new source for .NET Developers
""TerryFei"" <v-******@online.microsoft.com> wrote in message
news:9k**************@TK2MSFTNGXA02.phx.gbl...
Hi Sev,
Welcome to MSDN Newsgroup!

Based on the current situation, please help me confirm what's the meaning
of "test GUID string"? If you want to test whether or not the GUID string
is valid, I agree with Chris's comment and suggest you could use regular
expression to achieve this goal.

I hope the above information is helpful for you. If you have any
questions,
please feel free to let me know. Thanks and have a nice day!

Best Regards,

Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security

--------------------
Reply-To: "SevDer" <se******@sevder.com>
From: "SevDer" <se****@newsgroup.nospam>
Subject: Is there a way to test guid string?
Date: Thu, 26 Jan 2006 17:48:19 -0500
Lines: 15
Organization: http://www.sevder.com
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
Message-ID: <eh**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.csharp
NNTP-Posting-Host: mail.dtfares.com 68.167.20.2
Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.languages.csharp:38155 9
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

Is there a way to test guid string?

I want to do it without try catch block to save on performance.

Thanks in advance.
--

SevDer
http://www.sevder.com
A new source for .NET Developers

Jan 27 '06 #6

P: n/a
Hi Sev,
Thanks for your quick response!

Based on my knowledge, there is no a built in method for this. But RegEx
really could works as a workaround for this issue. I am glad to know our
information is helpful for you. Thanks for participating the community.
It's my pleasure to work with you!

Best Regards,

Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security

--------------------
Reply-To: "SevDer" <se******@sevder.com>
From: "SevDer" <se****@newsgroup.nospam>
References: <eh**************@tk2msftngp13.phx.gbl> <9k**************@TK2MSFTNGXA02.phx.gbl>Subject: Re: Is there a way to test guid string?
Date: Fri, 27 Jan 2006 10:07:12 -0500
Lines: 74
Organization: http://www.sevder.com
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
Message-ID: <#q**************@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.csharp
NNTP-Posting-Host: mail.dtfares.com 68.167.20.2
Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.languages.csharp:381738
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

Thanks everybody for your valuable time and comments.
I actually wanted to know if there is a built in method to do that, but
RegEx works for me.

Regards to all

--

SevDer
http://www.sevder.com
A new source for .NET Developers
""TerryFei"" <v-******@online.microsoft.com> wrote in message
news:9k**************@TK2MSFTNGXA02.phx.gbl...
Hi Sev,
Welcome to MSDN Newsgroup!

Based on the current situation, please help me confirm what's the meaning
of "test GUID string"? If you want to test whether or not the GUID string
is valid, I agree with Chris's comment and suggest you could use regular
expression to achieve this goal.

I hope the above information is helpful for you. If you have any
questions,
please feel free to let me know. Thanks and have a nice day!

Best Regards,

Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security

--------------------
Reply-To: "SevDer" <se******@sevder.com>
From: "SevDer" <se****@newsgroup.nospam>
Subject: Is there a way to test guid string?
Date: Thu, 26 Jan 2006 17:48:19 -0500
Lines: 15
Organization: http://www.sevder.com
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
Message-ID: <eh**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.csharp
NNTP-Posting-Host: mail.dtfares.com 68.167.20.2
Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.languages.csharp:3815 59
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

Is there a way to test guid string?

I want to do it without try catch block to save on performance.

Thanks in advance.
--

SevDer
http://www.sevder.com
A new source for .NET Developers



Jan 28 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.