473,544 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there a way to test guid string?

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
6 7187
SevDer,

What do you mean exactly? To test what?

--

Stoitcho Goutsev (100)

"SevDer" <se****@newsgro up.nospam> wrote in message
news:eh******** ******@tk2msftn gp13.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
SevDer <se****@newsgro up.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.co m>
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
"SevDer" <se****@newsgro up.nospam> wrote in news:eh******** ******@tk2msftn gp13.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
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******@sevde r.com>
From: "SevDer" <se****@newsgro up.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.publi c.dotnet.langua ges.csharp
NNTP-Posting-Host: mail.dtfares.co m 68.167.20.2
Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
Xref: TK2MSFTNGXA02.p hx.gbl microsoft.publi c.dotnet.langua ges.csharp:3815 59
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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
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.m icrosoft.com> wrote in message
news:9k******** ******@TK2MSFTN GXA02.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******@sevde r.com>
From: "SevDer" <se****@newsgro up.nospam>
Subject: Is there a way to test guid string?
Date: Thu, 26 Jan 2006 17:48:19 -0500
Lines: 15
Organizatio n: 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.publi c.dotnet.langua ges.csharp
NNTP-Posting-Host: mail.dtfares.co m 68.167.20.2
Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.pub lic.dotnet.lang uages.csharp:38 1559
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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
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******@sevde r.com>
From: "SevDer" <se****@newsgro up.nospam>
References: <eh************ **@tk2msftngp13 .phx.gbl> <9k************ **@TK2MSFTNGXA0 2.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.publi c.dotnet.langua ges.csharp
NNTP-Posting-Host: mail.dtfares.co m 68.167.20.2
Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
Xref: TK2MSFTNGXA02.p hx.gbl microsoft.publi c.dotnet.langua ges.csharp:3817 38
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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.m icrosoft.com> wrote in message
news:9k******* *******@TK2MSFT NGXA02.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******@sevde r.com>
From: "SevDer" <se****@newsgro up.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.publi c.dotnet.langua ges.csharp
NNTP-Posting-Host: mail.dtfares.co m 68.167.20.2
Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!tk 2msftngp13.phx. gbl
Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.pu blic.dotnet.lan guages.csharp:3 81559
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2732
by: BigDadyWeaver | last post by:
I am using the following code in asp to define a unique and unpredictable record ID in Access. <% 'GENERATE UNIQUE ID Function genguid() Dim Guid guid = server.createobject("scriptlet.typelib").guid guid=Left(guid,instr(guid,"}")) genguid=guid
9
34823
by: Rene | last post by:
I am using the Guid.Empty value ("00000000-0000-0000-0000-000000000000") to represent a special meaning. The problem is that I don't know if there is a chance that a command like "Guid.NewGuid()"would generate a Guid.Empty value could this be possible or is the "00000000-0000-0000-0000-000000000000" Guid reserved or something like that? ...
1
9119
by: Scott M. Lyon | last post by:
I've got a stored procedure that takes a few parameters as input parameters, and one output parameter (a uniqueidentifier). After the stored procedure call, I need to return that output parameter in a System.Guid object. Unfortunately, I'm having zero luck doing this. Public Function BuildExtract(byval ProjectNumber as string, byval...
1
3048
by: Scott M. Lyon | last post by:
I've got a stored procedure that takes a few parameters as input parameters, and one output parameter (a uniqueidentifier). After the stored procedure call, I need to return that output parameter in a System.Guid object. Unfortunately, I'm having zero luck doing this. Public Function BuildExtract(byval ProjectNumber as string, byval...
1
4099
by: Wolf | last post by:
Hi I am trying to set a property(PartyHomeAddressID) = to a guid in a ini file. But everytime when the ini file has an empty guid it breaks with an error tellin me a guid is 32 char long with 4 dashes. client.PartyHomeAddressID = new Guid(contact.Substring(1542, 36).Trim());
0
1032
by: PrettySneaky | last post by:
I have at the moment written two webservice prototypes and I am trying do some stress testing with Microsoft application center test. My web page communicates with the the webservice like this: 1. Call a register method and receives a string which is a Guid value 2. Call a read values method that takes the Guid string as parameter 3. Call...
5
6479
by: Michael Primeaux | last post by:
I have a simple .NET 2.0 web service created with VS.NET 2005 with a single web method with the following signature: void HelloWorld(Guid parameter1); When calling this method I receive the following error: System.IndexOutOfRangeException: Index was outside the bounds of the array. at...
2
16157
by: Troll | last post by:
Windows XP Pro VS 2005 & C# (I'm fairly new to C# but have doing VB.Net going on 2yrs and VB6 for 5yrs.) I'm using C# to build a custom RSS generator. I'm having trouble building the guid element for each item node in my feed. Some items do not have the "link" node because the description element is the content. So using the "link" as the...
4
5508
by: Marc | last post by:
Hi, I don't get it I cannot get this to work, can somebody give me a hint Table1 contains a field Id which is a GUID as primary key and DATA a string, I want to insert a new row but it does not work. void gv_RowCommand(Object sender, GridViewCommandEventArgs e) { ClientScript.RegisterStartupScript(GetType(), "MyAlert2", "alert('Command="...
0
7431
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7617
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7779
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7387
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7714
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5920
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4924
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3415
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.