Posted: 12/12/2010
Hi,I have my GUID as 15208bff-0e77-4439-9dfb-0c6de2b5394c . I need to strip (-) hyphens from it. How can I do it ?
using System; namespace ConsoleApplication1 { class MyMain { public static void Main() { string guid = Guid.NewGuid().ToString("n"); Console.WriteLine(guid);//8f1355c0d3084ac7a316d2098550fc4d Console.ReadLine(); } } }
peter-smith said: user="peter smith"]Hi,I have my GUID as 15208bff-0e77-4439-9dfb-0c6de2b5394c . I need to strip (-) hyphens from it. How can I do it ?
user="peter smith"]
You can also just replace the "-" with String.Empty
Example:
string Guid = "15208bff-0e77-4439-9dfb-0c6de2b5394c"; string GuidStripped = Guid.Replace("-", String.Empty); Response.Write(GuidStripped);