我有这个字符串:
Dim stringToCleanUp As String = "bon;jour" Dim characterToRemove As String = ";"
Function RemoveCharacter(ByVal stringToCleanUp,ByVal characterToRemove) ... End Function
这是什么功能?
回答:
Dim cleanString As String = Replace(stringToCleanUp,characterToRemove,"")
万分感谢!
Function RemoveCharacter(ByVal stringToCleanUp,ByVal characterToRemove) ' replace the target with nothing ' Replace() returns a new String and does not modify the current one Return stringToCleanUp.Replace(characterToRemove,"") End Function
这里有更多关于VB’s Replace function的信息