Replace Function in VB.NET

How to replace occurences of string using replace function?


String Replace in VB.NET

Replace Function in Visual is used to replace a substring by another substring, the specified number of times in a string.

Function Replace( ByVal Expression As String,
ByVal Find As String, ByVal Replacement As String) As String

In the above syntax String specifies the string to find the substring specified in Find and replace it with the substring specified in Replacement.

Module Module1
Sub Main()
Console.WriteLine("String replaced with oo is:: " &
Replace("World xx Wide xx Web xx", "x", "o"))
End Sub
End Module

String replaced with oo is:: World oo Wide oo Web oo

In the above replace function example, the substring 'xx' are replaced with the substring 'oo'.

Visual Basic Tutorial

Ask Questions

Ask Question