16.13. Insert, Remove and Replace Methods of Class StringBuilder

Class StringBuilder provides 18 overloaded Insert methods to allow values of various types to be inserted at any position in a StringBuilder. There are versions of Insert for each of the primitive types and for character arrays, Strings and Objects. Each version takes its second argument, converts it to a String and inserts the String into the StringBuilder at the index specified by the first argument. The index must be greater than or equal to 0 and less than the length of the StringBuilder; otherwise, an ArgumentOutOfRangeException occurs.

Class StringBuilder also provides method Remove for deleting characters in a StringBuilder. Method Remove takes two arguments—the index at ...

Get Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.