Insert and Remove of the StringBuilder class
Imports System
Imports System.Text
Public Class MainClass
Shared Sub Main()
Dim objectValue As Object = "hello"
Dim stringValue As String = "good bye"
Dim characterArray As Char() = {"a"c, "b"c, "c"c, _
"d"c, "e"c, "f"c}
Dim booleanValue As Boolean = True
Dim characterValue As Char = "K"c
Dim integerValue As Integer = 7
Dim longValue As Long = 1123456
Dim singleValue As Single = 2234.4325
Dim doubleValue As Double = 33.3
Dim buffer As StringBuilder = New StringBuilder()
' insert values into buffer
buffer.Insert(0, objectValue)
buffer.Insert(0, " ")
buffer.Insert(0, stringValue)
buffer.Insert(0, " ")
buffer.Insert(0, characterArray)
buffer.Insert(0, " ")
buffer.Insert(0, booleanValue)
buffer.Insert(0, " ")
buffer.Insert(0, characterValue)
buffer.Insert(0, " ")
buffer.Insert(0, integerValue)
buffer.Insert(0, " ")
buffer.Insert(0, longValue)
buffer.Insert(0, " ")
buffer.Insert(0, singleValue)
buffer.Insert(0, " ")
buffer.Insert(0, doubleValue)
buffer.Insert(0, " ")
Console.WriteLine("buffer after inserts:" & vbCrLf & _
buffer.ToString() )
buffer.Remove(12, 1)
buffer.Remove(2, 4)
Console.WriteLine("buffer after Removes:" & vbCrLf & _
buffer.ToString())
End Sub ' Main
End Class
Related examples in the same category