This is more like a logical question, I just need an idea on how to best approach this problem.
I am trying to do this in visual basic. I have to text box, in text box 1, I would have some text and if it contains certain word, I want to replace that with something else and have the new output in text box 2, after clicking on a convert button.
I know this can be done really easily with the replace function built in, but I am trying to do it without the replace function.
For example:
I want to replace "fox" with "dog"
Textbox 1: The quick brown fox jumped over the lazy dog.
Textbox 2: The quick brown dog jumped over the lazy dog.
I got it to work with the code below, but this only works for the first instance. How can I change my code for all instances.
String from InputText
Dim S1 As String
S1 = InputText.Text
'Position of start of "Edge Computer"
Dim pStart As Integer
pStart = S1.IndexOf("Edge Computer")
'Position of end of "Edge Computer"
Dim pEnd As Integer
pEnd = S1.IndexOf("r", pStart) + 1
'Actual old name as string
Dim strOld As String
strOld = S1.Substring(pStart, 13)
'New String for Output
Dim S2 As String
S2 = S1.Substring(0, pStart) & "3dg3" & S1.Substring(pEnd)
OutputText.Text = S2
Thanks
Replacekeyword from VB6 you want to avoid? Would you be ok with the String.Replace or Regex.Replace functions that are fully ".net compliant"?