من یک همچین تیکه کدی هم توی vb براش دارم حالا میخام همین را توی MVCپیاده اش کنم ولی نمیدانم چچطور باید این کار بکنم
PublicSharedFunction removeSpaceAndSpesialChar(ByVal strTitle AsObject) AsString
If (IsDBNull(strTitle)) Then
strTitle = "بدون عنوان"
EndIf
If (strTitle.ToString.Length = 0) Then
strTitle = "بدون عنوان"
EndIf
strTitle = strTitle.Trim()
strTitle = Regex.Replace(strTitle, "<(.|\n)*?>", String.Empty)
'Trim "-" Hyphen
strTitle = strTitle.Trim("-"c)
strTitle = strTitle.ToLower()
Dim chars AsChar() = "$%#@!*?;:~`+=()[]{}|\'<>,/^&"".".ToCharArray()
strTitle = strTitle.Replace("C#", "C-Sharp")
strTitle = strTitle.Replace("vb.net", "VB-Net")
strTitle = strTitle.Replace("asp.net", "Asp-Net")
'Replace . with - hyphen
strTitle = strTitle.Replace(".", "-")
'Replace Special-Characters
For i AsInteger = 0 To chars.Length - 1
Dim strChar AsString = chars.GetValue(i).ToString()
If strTitle.Contains(strChar) Then
strTitle = strTitle.Replace(strChar, String.Empty)
EndIf
Next
'Replace all spaces with one "-" hyphen
strTitle = strTitle.Replace(" ", "-")
'Replace multiple "-" hyphen with single "-" hyphen.
strTitle = strTitle.Replace("--", "-")
strTitle = strTitle.Replace("---", "-")
strTitle = strTitle.Replace("----", "-")
strTitle = strTitle.Replace("-----", "-")
strTitle = strTitle.Replace("----", "-")
strTitle = strTitle.Replace("---", "-")
strTitle = strTitle.Replace("--", "-")
strTitle = strTitle.Replace("'", "-")
'Run the code again...
'Trim Start and End Spaces.
strTitle = strTitle.Trim()
'Trim "-" Hyphen
strTitle = strTitle.Trim("-"c)
Return strTitle
EndFunction