The rationale that the net framework
Classes and Objects (with a Short Introduction to Object-Oriented Programming)
To quickly make a StringBuilder with 25,000 copies of the letter A, for example, you would write:
The Length property lets you get or set the current length of the StringBuilder.
If you specify a Length less than the current size, VB truncates the StringBuilder object. If you have created a StringBuilder object with a maximum capacity, then you get an exception if the length you specify is greater than the maximum capacity. (See Chapter 7 for more on exceptions.)
The members of the StringBuilder class that you will use most frequently are very overloaded. They come in so many versions so that you can, for example, add or remove strings, numbers, characters, or an array of characters equally well. For example, the useful Append method adds characters at the end of the StringBuilder:
117
Chapter 4
• Replace(ByVal oldValue As String, ByVal newValue As String): Replaces all instances of the old string with the new one
You can also use:
You call the ToString method to convert a StringBuilder to a String when you do not want to make any more changes to it and only want to look at its parts from that point on.
CAUTION |
|
---|
|
---|
118