Hi guys
I've run into a bit of an issue which I'm struggling with and wonder if anyone can give me an idea of what I'm missing.
I have an array based on a structure which in turn has three string values. I'm unable to use Replace to remove or replace a character in one of those strings (.Value) - it does nothing.
If I manually loop through the string and look for the the character to be replaced, I can delete or replace without issue.
I get no errors and the code continues on - just Replace has no effect.
Any thoughts? Is this an issue due to Replace not being able to dela with the structure?
Here's the code in question (only):
Code:
Public Module Module_Definitions
Public Structure CMDlineDBstruct
Public Value As String
Public StartPos As Integer
Public EndPos As Integer
End Structure
Public CMDlineDB(100) As CMDlineDBstruct
End Module
' The following does *not* work
Public Class CmdParser
Public Sub RemoveChrFromCMDlineDB(c As String)
For i As Integer = 1 To CMDlineCount
Replace(CMDlineDB(i).Value, c, "")
Next
End Sub
End Class
' Where-as the following works
Public Class CmdParser
Public Sub t(c As String)
For i As Integer = 1 To CMDlineCount
For k As Integer = 1 To Len(CMDlineDB(i).Value)
If Mid(CMDlineDB(i).Value, k, 1) = c Then CMDlineDB(i).Value = Left(CMDlineDB(i).Value, k - 1) & Mid(CMDlineDB(i).Value, k + 1)
Next k
Next i
End Sub
End Class