I have created a function which will convert any string into tab delimited.
What's new in ASP.NET 4.0
Then it will convert above title to following:
what-s-new-in-asp-net-4-0
I am using this to make my URL's SEO'd. But I am not sure that it will work fine in all cases or not. Till now I have tested this function on around 1000 records in my database and its working fine for all titles. Guyz please check this function and let me know if there is possibility of failing this function, and if there is a possibility that this function may fail, then please tell me the correct function which I can use in my app.
public string SEO_makeTitle(object objTitle)
{
string strTitle = Convert.ToString(objTitle);
strTitle = Regex.Replace(strTitle.Trim(), @"\W", " "); //replace special chars
strTitle = Regex.Replace(strTitle.Trim(), @"\s{2,}", " "); //replace double space
strTitle = strTitle.Trim().Replace(" ", "-").ToLower();
return strTitle; //return - delimited title
}
Thanks