Imports System
Imports System.Text
Class Sample
Public Shared Sub Main()
Dim str As String = "The quick br!wn d#g jumps #ver the lazy cat."
Dim sb As New StringBuilder(str)
Console.WriteLine("{0}", sb.ToString())
sb.Replace("#"c, "!"c, 15, 29) ' Some '#' -> '!'
Console.WriteLine("{0}", sb.ToString())
sb.Replace("!"c, "o"c) ' All '!' -> 'o'
Console.WriteLine("{0}", sb.ToString())
sb.Replace("cat", "dog") ' All "cat" -> "dog"
Console.WriteLine("{0}", sb.ToString())
sb.Replace("dog", "fox", 15, 20) ' Some "dog" -> "fox"
Console.WriteLine("Final value:")
Console.WriteLine("{0}", sb.ToString())
End Sub 'Main
End Class