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.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The string doesn’t need to be unique, actually : if you check the URL of this post :
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 :
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 :