Replace method. : StringBuilder « Data Type « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » Data Type » StringBuilder 
2.40.7.Replace method.
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, 1529)   ' 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"1520' Some "dog" -> "fox"
      Console.WriteLine("Final value:")
      Console.WriteLine("{0}", sb.ToString())
   End Sub 'Main

      
End Class
2.40.StringBuilder
2.40.1.Demonstrating StringBuilder class constructors
2.40.2.StringBuilder: Insert string, Append and Replace
2.40.3.Append Char to StringBuilder
2.40.4.Demonstrating StringBuilder Append methods
2.40.5.StringBuilder AppendFormat
2.40.6.StringBuilder.AppendFormat: {0:D} is ${1: #,###.00}
2.40.7.Replace method.
2.40.8.Insert method of StringBuilder
2.40.9.StringBuilder: Length, Capacity, EnsureCapacity
2.40.10.Use StringBuilder Indexer
2.40.11.Demonstrating methods Insert and Remove of the StringBuilder class
2.40.12.Demonstrating method Replace
2.40.13.Use StringBuilder to reverse a string
2.40.14.StringBuilder.ToStrings
2.40.15.Performance difference between String and StringBuilder
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.