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 ?
ANSWER:
Dim cleanString As String = Replace(stringToCleanUp, characterToRemove, "")
Great, Thanks!
This question is related to
vb.net
string
visual-studio-2010
The string
class's Replace
method can also be used to remove multiple characters from a string:
Dim newstring As String
newstring = oldstring.Replace(",", "").Replace(";", "")
The String
class has a Replace
method that will do that.
Dim clean as String
clean = myString.Replace(",", "")
You can use the string.replace method
string.replace("character to be removed", "character to be replaced with")
Dim strName As String
strName.Replace("[", "")
Source: Stackoverflow.com