/// <summary>
/// clear text to put in url
/// </summary>
public string ClearString(string title)
{
// Substitute spaces
// Remove illegal characters
string normalizedString = title.Normalize(NormalizationForm.FormD);
StringBuilder sb
= new StringBuilder
();
for (int i = 0; i < normalizedString.Length; i++)
{
UnicodeCategory uc = CharUnicodeInfo.GetUnicodeCategory(normalizedString[i]);
if (uc != UnicodeCategory.NonSpacingMark)
{
sb.Append(normalizedString[i]);
}
}
return sb.ToString().Normalize(NormalizationForm.FormD).Trim().Replace("-", "").Replace(",", "").Replace(" ", "-").Replace(".", "-").Replace("¿", "").Replace("?", "").Replace("!", "").Replace("¡", "").Replace("--", "-").Replace(Convert.ToChar(34).ToString(), "").Replace(":","-").Replace("%","") + "/";
}