Mega Code Archive

 
Categories / VB.Net / Language Basics
 

StringBuilder Insert Method

Imports System Imports System.Text Class Sample    Private Shared sb As StringBuilder    Public Shared Sub Main()       Dim xyz As String = "xyz"       Dim abc As Char() =  {"a"c, "b"c, "c"c}       Dim star As Char = "*"c       Dim obj As [Object] = 0       Dim xBool As Boolean = True       Dim xByte As Byte = 1       Dim xInt16 As Short = 2       Dim xInt32 As Integer = 3       Dim xInt64 As Long = 4       Dim xDecimal As [Decimal] = 5       Dim xSingle As Single = 6.6F       Dim xDouble As Double = 7.7       sb = New StringBuilder()       sb.Insert(3, xInt32)    ' 3       Console.WriteLine(sb)       sb.Insert(3, xInt64)    ' 4       Console.WriteLine(sb)       sb.Insert(3, xDecimal)  ' 5       Console.WriteLine(sb)       sb.Insert(3, xSingle)   ' 6.6       Console.WriteLine(sb)       sb.Insert(3, xDouble)   ' 7.7       Console.WriteLine(sb)    End Sub  End Class