How to find and replace all occurrences of a substring in a string with VB.NET

1 Answer

0 votes
Imports System

Public Class FindAndReplaceAllOccurrencesOfASubstringInAString_VB_NET
    Public Shared Sub Main(ByVal args As String())
        Dim str As String = "java php go c python php phpphphp php rust"
        Dim word As String = "php"
        Dim replacewith As String = "VB"
		
        str = str.Replace(word, replacewith)
		
        Console.WriteLine(str)
    End Sub
End Class


' run:
'
' java VB go c python VB VBVBhp VB rust
'

 



answered Aug 25, 2024 by avibootz
...