How can i generate a unique string from the post title in my C# code ? Similar to the one which appears in the url of this post.
The string doesn't need to be unique, actually : if you check the URL of this post :
http://stackoverflow.com/questions/1467402/generate-a-unique-string-from-the-post-title-like-stackoverflow
The "real" unique part is the number -- here, 1467402 : it looks like the identifier of the question in the database ; probably some kind of auto-increment / sequence, which is ensured to be unique by the database server.
Actually, you can try to check by yourself if the "title" part matters : go to this URL :
http://stackoverflow.com/questions/1467402/glop
Even though the "title" part is obviously not here, that URL this gets you to this post ;-)
The "title" appearing in the URL is here for two reasons :
To generate this, a couple of thing to do :
This is a very broad question.
Most of the time when I need to identify something unique, I use a Guid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With