From RAD Studio API Documentation
Jump to: navigation, search



TStringBuilder = class


class PASCALIMPLEMENTATION TStringBuilder : public System::TObject


Type Visibility Source Unit Parent
class public
System.SysUtils System.SysUtils


An editable array of characters whose content has all the functionality of a string object.

Use a TStringBuilder as an editable string.

The TStringBuilder class is completely compatible with the .NET framework's StringBuilder (MSDN) class. Use a TStringBuilder instance to hold a character array. This array can be modified after creation. Substrings can be appended, searched and replaced, or inserted. The character array can be queried by index or converted to a string for comparison.

The character array can be referenced directly by using the Chars property. The Length property contains the current length of the character array.

builder.Length = builder.ToString.Length;

The Capacity property holds the current allocated storage space for the TStringBuilder instance. Capacity can be increased up to the value of MaxCapacity and decreased down to the current value of Length. Capacity is increased if Length is increased or the character array is altered by appending to increase its length.

The Append method converts a multitude of possible types to a string and appends that to the current character array. AppendFormat allows you to append several objects to the character array, each object with its own format.

The Equals method compares a specified object or another TStringBuilder to the instance of TStringBuilder.

The Append, CopyTo, Insert, Remove, and Replace methods access the character array by index or search for the character as a string. The ToString method converts the character array to a string in order to provide string functionality.

TStringBuilder is an implementation of the .NET StringBuilder (MSDN) class.

See Also

Code Examples