StringBuilder.Clear Method removes all characters from the current StringBuilder instance.
Imports System.Text
Module Example
Public Sub Main()
Dim sb As New StringBuilder("This is a string.")
Console.WriteLine("{0} ({1} characters)", sb.ToString(), sb.Length)
sb.Clear()
Console.WriteLine("{0} ({1} characters)", sb.ToString(), sb.Length)
sb.Append("This is a second string.")
Console.WriteLine("{0} ({1} characters)", sb.ToString(), sb.Length)
End Sub
End Module
Related examples in the same category