Pinku

Pinku

  • 1.5k
  • 294
  • 44.9k

How to remove special character from string

Oct 15 2024 4:43 PM

Title='U.S. History-part 1' 
Dim cleanString As String = Regex.Replace(title, "[^a-zA-Z 0-9-/-]", "")
The result I am getting is : US History-part 1 but I need like : US History part 1 . So if there is hiffen that should also replace with  blank space. 
The title data is dynamic . I have just given a example.
Below is some example of what it should be from left to right.
U.S. History-part 1  => US History part 1
U.S. History.part.1  => US History part 1
U.S- History : part 1  => US History part 1


Answers (2)