System.SysUtils.TStringBuilder

From RAD Studio API Documentation
Jump to: navigation, search

System.TObjectTStringBuilder

Delphi

TStringBuilder = class

C++

class PASCALIMPLEMENTATION TStringBuilder : public System::TObject

Properties

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

Description

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