VB.NET – Remove a characters from a String

I have this string:

Dim stringToCleanUp As String = "bon;jour"
Dim characterToRemove As String = ";"

I want a function who removes the ‘;’ character like this:

Function RemoveCharacter(ByVal stringToCleanUp, ByVal characterToRemove)
End Function

What would be the function ?


Dim cleanString As String = Replace(stringToCleanUp, characterToRemove, "")

Great, Thanks!


The String class has a Replace method that will do that.

Dim clean as String
clean = myString.Replace(",", "")

Source : Link , Question Author : Jonathan Rioux , Answer Author : Oded

1 thought on “VB.NET – Remove a characters from a String”

Leave a Comment