StringBuilder

StringBuilder class

Buffer to accumulate string part by part. This type can be allocated either in stack as value type or in heap using System::MakeObject() function. Once the object is allocated, never mix up these two usecases: having SmartPtr pointers onto stack-allocated objects is strictly prohibited.

class StringBuilder : public System::Object

Methods

MethodDescription
StringBuilder * Append(char_t)Adds character to builder.
StringBuilder * Append(char_t, int)Adds characters to builder.
StringBuilder * Append(const ArrayPtr<char_t>&)Adds characters array to builder.
StringBuilder * Append(const ArrayPtr<char_t>&, int, int)Adds characters array slice to builder.
StringBuilder * Append(const String&)Adds string to builder.
StringBuilder * Append(const String&, int, int)Adds string slice to builder.
StringBuilder * Append(const SharedPtr<T>&)Adds object’s string representation to builder.
StringBuilder * Append(const SharedPtr<StringBuilder>&)Adds builder’s content to builder.
StringBuilder * Append(float)Adds floating point value to builder.
StringBuilder * Append(double)Adds floating point value to builder.
StringBuilder * Append(int)Adds integer value to builder.
std::enable_if<std::is_arithmetic<T>::value, StringBuilder *>::type Append(T)Adds arithmetic value to builder.
std::enable_if<std::is_enum<E>::value, StringBuilder *>::type Append(E)Adds enum value string representation to builder.
StringBuilder * AppendFormat(const String&, const TArgs&…)Appends formated string to builder.
StringBuilder * AppendFormat(const SharedPtr<IFormatProvider>&, const String&, const TArgs&…)Appends formated string to builder.
StringBuilder * AppendLine()Appends new line character to builder.
StringBuilder * AppendLine(const String&)Appends string followed by new line character to builder.
StringBuilder * Clear()Removes all characters from the builder.
void CopyTo(int, System::ArrayPtr<char_t> const&, int, int)Copies builder’s data into existing array positions.
virtual bool Equals(ptr)Compares objects using C# Object.Equals semantics.
static std::enable_if<IsSmartPtr<T1>::value&&IsSmartPtr<T2>::value, bool>::type Equals(T1 const&, T2 const&)Compares reference type objects in C# style.
static std::enable_if<!IsSmartPtr<T1>::value&&!IsSmartPtr<T2>::value, bool>::type Equals(T1 const&, T2 const&)Compares value type objects in C# style.
static bool Equals(float const&, float const&)Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN.
static bool Equals(double const&, double const&)Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN.
virtual bool FastCast(const Details::FastRttiBase&, void **) constFor internal purposes only.
int get_Capacity() constGets current capacity of string builder.
int get_Length() constGets length of string currently in builder.
Detail::SmartPtrCounter * GetCounter()Gets reference counter data structure associated with the object.
virtual int32_t GetHashCode() constAnalog of C# Object.GetHashCode() method. Enables hashing of custom objects.
virtual const TypeInfo& GetType() constGets actual type of object. Analog of C# System.Object.GetType() call.
char_t idx_get(int) constGets character at specified position.
void idx_set(int, char_t)Sets character at specified position.
StringBuilder * Insert(int, const String&)Inserts string into builder’s fixed position.
StringBuilder * Insert(int32_t, const String&, int32_t)Inserts repeated string into builder’s fixed position.
StringBuilder * Insert(int, char_t)Inserts character into builder’s fixed position.
StringBuilder * Insert(int, const System::ArrayPtr<char_t>&, int, int)Inserts characters into builder’s fixed position.
std::enable_if<std::is_arithmetic<T>::value, StringBuilder *>::type Insert(int, T)Inserts value into builder’s fixed position.
virtual bool Is(const TypeInfo&) constCheck if object represents an instance of type described by targetType. Analog of C# ‘is’ operator.
void Lock()Implements C# lock() statement locking. Call directly or use LockContext sentry object.
virtual ptr MemberwiseClone() constAnalog of C# Object.MemberwiseClone() method. Enables cloning custom types.
Object()Creates object. Initializes all internal data structures.
Object(Object const&)Copy constructor. Doesn’t copy anything, really, just initializes new object and enables copy constructing subclasses.
Object& operator=(Object const&)Assignment operator. Doesn’t copy anything, really, just initializes new object and enables copy constructing subclasses.
char_t operator[](int) constGets character at specified position.
static bool ReferenceEquals(ptr const&, ptr const&)Compares objects by reference.
static std::enable_if<!IsSmartPtr<T>::value, bool>::type ReferenceEquals(T const&, T const&)Compares objects by reference.
static std::enable_if<!IsSmartPtr<T>::value, bool>::type ReferenceEquals(T const&, std::nullptr_t)Reference-compares value type object with nullptr.
bool ReferenceEquals(String const&, std::nullptr_t)Specialization of Object::ReferenceEquals for case of string and nullptr.
bool ReferenceEquals(String const&, String const&)Specialization of Object::ReferenceEquals for case of strings.
StringBuilder * Remove(int, int)Removes fragment from builder.
int RemovedSharedRefs(int)Decreases shared reference count by specified value.
StringBuilder * Replace(const String&, const String&)Replaces substring through the builder.
StringBuilder * Replace(const String&, const String&, int, int)Replaces substring through the builder’s range.
StringBuilder * Replace(char_t, char_t)Replaces character through the builder.
StringBuilder * Replace(char_t, char_t, int, int)Replaces character through the builder’s range.
void set_Capacity(int)Sets current capacity of string builder.
void set_Length(int)Trunkates or extends string builder to specified length.
virtual void SetTemplateWeakPtr(uint32_t)Set n’th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode.
int SharedCount() constGets current value of shared reference counter.
Object * SharedRefAdded()Increments shared reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
int SharedRefRemovedSafe()Decrements and returns shared reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
StringBuilder()Constructor.
StringBuilder(int)Constructor.
StringBuilder(const String&)Constructor.
StringBuilder(const String&, int)Constructor.
StringBuilder(const String&, int, int, int)Constructor.
String ToString() const overrideGets string currently contained in builder.
String ToString(int, int) constGets substring currently contained in builder.
static const TypeInfo& Type()Implements C# typeof(System.Object) construct.
void Unlock()Implements C# lock() statement unlocking. Call directly or use LockContext sentry object.
Detail::SmartPtrCounter * WeakRefAdded()Increments weak reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
void WeakRefRemoved()Decrements weak reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
virtual ~Object()Destroys object. Frees all internal data structures.
~StringBuilder()Destructor.

See Also