StringBuilder.Insert Method : StringBuilder « Language Basics « VB.Net






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 

   
  








Related examples in the same category

1.Use StringBuilder for fast processing stringsUse StringBuilder for fast processing strings
2.StringBuilder Performance Test
3.StringBuilder: Char and ReplaceStringBuilder: Char and Replace
4.Demonstrating StringBuilder class constructorsDemonstrating StringBuilder class constructors
5.StringBuilder Length and CapacityStringBuilder Length and Capacity
6.Use StringBuilder IndexerUse StringBuilder Indexer
7.StringBuilder Append methodsStringBuilder Append methods
8.StringBuilder method AppendFormatStringBuilder method AppendFormat
9.Insert and Remove of the StringBuilder classInsert and Remove of the StringBuilder class
10.StringBuilder Replace methodStringBuilder Replace method
11.Append String to StringBuilderAppend String to StringBuilder
12.Append bool data type values to a StringBuilder object.
13.Append SByte data type values to a StringBuilder object.
14.Insert String to StringBuilder
15.Insert char array to StringBuilder
16.Insert Object to StringBuilder
17.Insert xInt32 to StringBuilder
18.Insert System.SByte to StringBuilder
19.StringBuilder Class represents a mutable string of characters
20.Append three characters (D, E, and F) to the end of the StringBuilder
21.Append a format string to the end of the StringBuilder
22.Display the number of characters in the StringBuilder and its string
23.Insert a string at the beginning of the StringBuilder
24.Replace all uppercase A's with lowercase A's
25.TextElementEnumerator Class enumerates the text elements of a string.
26.TextInfo.ToTitleCase Converts the specified string to titlecase.
27.FieldAttributes Enumeration specifies flags that describe the attributes of a field.
28.BindingFlags.Public Or BindingFlags.Instance
29.BindingFlags.Public Or BindingFlags.Static
30.FileStream Class Exposes a Stream around a file
31.FileStream("c:\Variables.txt", FileMode.Append, FileAccess.Write, FileShare.Write)
32.Marks each type of member that is defined as a derived class of MemberInfo.
33.StringBuilder Class represents a mutable string of characters
34.Create StringBuilder class that starts with a specified capacity and can grow to a specified maximum.
35.Create StringBuilder class using the specified string.
36.Create StringBuilder class using the specified string and capacity.
37.Create StringBuilder class from the specified substring and capacity.
38.Appends various data to StringBuilder
39.StringBuilder.AppendFormat Method
40.StringBuilder.AppendLine Method appends line terminator to the end of the current StringBuilder object.
41.StringBuilder.Capacity Property gets or sets the maximum number of characters that can be contained
42.StringBuilder.Clear Method removes all characters from the current StringBuilder instance.
43.StringBuilder.Remove removes the specified range of characters from this instance.
44.StringBuilder.Replace replaces all occurrences of a character in this instance with another specified character.