xtd 0.2.0
Loading...
Searching...
No Matches
xtd::text::basic_string_builder< char_t, traits_t, allocator_t > Class Template Referencefinal
Inheritance diagram for xtd::text::basic_string_builder< char_t, traits_t, allocator_t >:
xtd::object xtd::iequatable< type_t > xtd::interface xtd::extensions::equality_operators< type_t, iequatable< type_t > >

Definition

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
class xtd::text::basic_string_builder< char_t, traits_t, allocator_t >

Represents a mutable string of characters. This class cannot be inherited.

Namespace
xtd::text
Library
xtd.core
Remarks
xtd::text::basic_string_builder class represents a string-like object whose value is a mutable sequence of characters.
xtd::text::basic_string_builder implements std::basic_string<char> and therefore offers the full API of std::basic_string<char>.
Several aliases for common character types are provided:
Type Definition
xtd::text::string_builder xtd::text::basic_string_builder <char>
xtd::text::u16string_builder xtd::text::basic_string_builder <xtd::char16>
xtd::text::u32string_builder xtd::text::basic_string_builder <xtd::char32>
xtd::text::u8string_builder xtd::text::basic_string_builder <xtd::char8>
xtd::text::wstring_builder xtd::text::basic_string_builder <xtd::wchar>

Public Aliases

using base_type
 Represents the basic string base type.
 
using traits_type
 Represents the basic string traits type.
 
using value_type
 Represents the basic string value type.
 
using allocator_type
 Represents the basic string allocator type.
 
using size_type
 Represents the basic string size type.
 
using difference_type
 Represents the basic string difference type.
 
using reference
 Represents the basic string referecne type.
 
using const_reference
 Represents the basic string const referecne type.
 
using pointer
 Represents the basic string pointer type.
 
using const_pointer
 Represents the basic string const pointer type.
 
using iterator
 Represents the basic string iterator type.
 
using const_iterator
 Represents the basic string const iterator type.
 
using reverse_iterator
 Represents the basic string reverse iterator type.
 
using const_reverse_iterator
 Represents the basic string const reverse iterator type.
 

Public Fields

static constexpr size_type npos
 Represents a value that is not a valid position in a collection.
 
static constexpr xtd::size bpos
 Represents the index of the first valid element in a collection.
 
static constexpr xtd::size epos
 Represents the index of the last valid element in a collection.
 

Public Constructors

 basic_string_builder ()=default
 Initializes a new instance of xtd::text::basic_string_builder.
 
 basic_string_builder (xtd::size capacity)
 Initializes a new instance of the xtd::text::basic_string_builder class using the specified capacity.
 
 basic_string_builder (xtd::size capacity, xtd::size max_capacity)
 Initializes a new instance of the xtd::text::basic_string_builder class that starts with a specified capacity and can grow to a specified maximum.
 
 basic_string_builder (const xtd::basic_string< value_type > &value)
 Initializes a new instance of the xtd::text::basic_string_builder class using the specified string.
 
 basic_string_builder (const xtd::basic_string< value_type > &value, xtd::size capacity)
 Initializes a new instance of the xtd::text::basic_string_builder class using the specified string and capacity.
 
 basic_string_builder (const xtd::basic_string< value_type > &value, xtd::size start_index, xtd::size length, xtd::size capacity)
 Initializes a new instance of the xtd::text::basic_string_builder class from the specified substring and capacity.
 
 basic_string_builder (const allocator_type &allocator) noexcept
 Initializes a new instance of xtd::text::basic_string_builder with specified allocator.
 
 basic_string_builder (const basic_string_builder &str) noexcept
 Initializes a new instance of xtd::text::basic_string_builder with specified string to copy.
 
 basic_string_builder (const basic_string_builder &str, const allocator_type &allocator) noexcept
 Initializes a new instance of xtd::text::basic_string_builder with specified string to copy and allocator.
 
 basic_string_builder (const basic_string_builder &str, xtd::size index)
 Initializes a new instance of xtd::text::basic_string_builder with specified substring at index.
 
 basic_string_builder (const basic_string_builder &str, xtd::size index, const allocator_type &allocator)
 Initializes a new instance of xtd::text::basic_string_builder with specified substring at index and allocator.
 
 basic_string_builder (const basic_string_builder &str, xtd::size index, xtd::size count)
 Initializes a new instance of xtd::text::basic_string_builder with specified substring at index and count characters.
 
 basic_string_builder (const basic_string_builder &str, xtd::size index, xtd::size count, const allocator_type &allocator)
 Initializes a new instance of xtd::text::basic_string_builder with specified substring at index, count characters and allocator.
 
 basic_string_builder (basic_string_builder &&str) noexcept
 Initializes a new instance of xtd::text::basic_string_builder with specified string to move.
 
 basic_string_builder (basic_string_builder &&str, const allocator_type &allocator) noexcept
 Initializes a new instance of xtd::text::basic_string_builder with specified string to move and allocator.
 
 basic_string_builder (xtd::size count, value_type character)
 
 basic_string_builder (xtd::size count, value_type character, const allocator_type &allocator)
 Initializes a new instance of xtd::text::basic_string_builder with specified count copies of character and specified allocator.
 
 basic_string_builder (value_type character, xtd::size count)
 Initializes a new instance of xtd::text::basic_string_builder with specified count copies of character.
 
 basic_string_builder (value_type character, xtd::size count, const allocator_type &allocator)
 Initializes a new instance of xtd::text::basic_string_builder with specified count copies of character and specified allocator.
 
 basic_string_builder (const_pointer str)
 Initializes a new instance of xtd::text::basic_string_builder with specified string to copy.
 
 basic_string_builder (const_pointer str, const allocator_type &allocator)
 Initializes a new instance of xtd::text::basic_string_builder with specified string to copy, and allocator.
 
 basic_string_builder (const_pointer str, xtd::size count)
 Initializes a new instance of xtd::text::basic_string_builder with specified substring and count characters.
 
 basic_string_builder (const_pointer str, xtd::size count, const allocator_type &allocator)
 Initializes a new instance of xtd::text::basic_string_builder with specified substring, count characters and allocator.
 
 basic_string_builder (const std::basic_string< value_type > &str) noexcept
 Initializes a new instance of xtd::text::basic_string_builder with specified string to copy.
 
 basic_string_builder (const std::basic_string< value_type > &str, const allocator_type &allocator) noexcept
 Initializes a new instance of xtd::text::basic_string_builder with specified string to copy and allocator.
 
template<class input_iterator_t>
 basic_string_builder (input_iterator_t first, input_iterator_t last)
 Initializes a new instance of xtd::text::basic_string_builder with specified first and last iterators of substring.
 
template<class input_iterator_t>
 basic_string_builder (input_iterator_t first, input_iterator_t last, const allocator_type &allocator)
 Initializes a new instance of xtd::text::basic_string_builder with specified first and last iterators of substring and allocator.
 
 basic_string_builder (std::initializer_list< value_type > il)
 Initializes a new instance of xtd::text::basic_string_builder with specified initializer list.
 
 basic_string_builder (std::initializer_list< value_type > il, const allocator_type &allocator)
 Initializes a new instance of xtd::text::basic_string_builder with specified initializer list and allocator.
 

Public Properties

auto begin () const -> const_iterator
 Returns an iterator to the first character of the string.
 
auto begin () -> iterator
 Returns an iterator to the first character of the string.
 
auto c_str () const noexcept -> const_pointer
 Returns a pointer to a null-terminated character array with data equivalent to those stored in the string.
 
auto capacity () const noexcept -> size_type
 Returns the number of characters that the string has currently allocated space for.
 
auto capacity (size_type value) -> basic_string_builder &
 Sets the number of characters that the string has currently allocated space for.
 
auto cbegin () const -> const_iterator
 Returns an iterator to the first character of the string.
 
auto chars () const noexcept -> const base_type &
 Returns a reference to the underlying base type.
 
auto chars () noexcept -> base_type &
 Returns a reference to the underlying base type.
 
auto cend () const -> const_iterator
 Returns an iterator to the character following the last character of the string. This character acts as a placeholder, attempting to access it results in undefined behavior.
 
auto data () const noexcept -> const_pointer
 Returns a pointer to the underlying array serving as character storage. The pointer is such that the range [data(), data() + size()] is valid and the values in it correspond to the values stored in the string.
 
auto data () noexcept -> pointer
 Returns a pointer to the underlying array serving as character storage. The pointer is such that the range [data(), data() + size()] is valid and the values in it correspond to the values stored in the string.
 
auto empty () const noexcept -> bool
 Checks if the string has no characters, i.e. whether begin() == end().
 
auto end () const -> const_iterator
 Returns an iterator to the character following the last character of the string. This character acts as a placeholder, attempting to access it results in undefined behavior.
 
auto end () -> iterator
 Returns an iterator to the character following the last character of the string. This character acts as a placeholder, attempting to access it results in undefined behavior.
 
auto length () const noexcept -> size_type
 Gets or sets the length of the current xtd::text::basic_string_builder object.
 
auto length (size_type value) noexcept -> basic_string_builder &
 Sets or sets the length of the current xtd::text::basic_string_builder object.
 
auto max_capacity () const noexcept -> size_type
 Returns the number of characters that the string has currently allocated space for.
 
auto size () const noexcept -> size_type
 Returns the number of char_t elements in the string, i.e. std::distance(begin(), end()).
 

Public Methods

auto append (const xtd::basic_string< char_t > &value) -> basic_string_builder &
 Appends a copy of the specified string to this instance.
 
auto append (const xtd::basic_string< char_t > &value, size_type start_index, size_type count) -> basic_string_builder &
 Appends a copy of a specified substring to this instance.
 
auto append (xtd::boolean value) -> basic_string_builder &
 Appends the string representation of a specified boolean value to this instance.
 
auto append (xtd::byte value) -> basic_string_builder &
 Appends the string representation of a specified 8-bit unsigned value to this instance.
 
auto append (xtd::decimal value) -> basic_string_builder &
 Appends the string representation of a specified decimal value to this instance.
 
auto append (double value) -> basic_string_builder &
 Appends the string representation of a specified double value to this instance.
 
auto append (xtd::single value) -> basic_string_builder &
 Appends the string representation of a specified single value to this instance.
 
auto append (xtd::int16 value) -> basic_string_builder &
 Appends the string representation of a specified 16-bit signed integer value to this instance.
 
auto append (xtd::int32 value) -> basic_string_builder &
 Appends the string representation of a specified 32-bit signed integer value to this instance.
 
auto append (xtd::int64 value) -> basic_string_builder &
 Appends the string representation of a specified 64-bit signed integer value to this instance.
 
auto append (xtd::sbyte value) -> basic_string_builder &
 Appends the string representation of a specified 8-bit signed integer value to this instance.
 
auto append (xtd::uint16 value) -> basic_string_builder &
 Appends the string representation of a specified 16-bit unsigned integer value to this instance.
 
auto append (xtd::uint32 value) -> basic_string_builder &
 Appends the string representation of a specified 32-bit unsigned integer value to this instance.
 
auto append (xtd::uint64 value) -> basic_string_builder &
 Appends the string representation of a specified 64-bit unsigned integer value to this instance.
 
auto append (value_type value) -> basic_string_builder &
 Appends the string representation of a specified xtd::text::basic_string_builder::value_type value to this instance.
 
auto append (value_type value, size_type repeat_count) -> basic_string_builder &
 Appends a specified number of copies of the string representation of a Unicode character to this instance.
 
template<class object_t>
auto append (object_t value) -> basic_string_builder &
 Appends the string representation of a specified object to this instance.
 
auto append (size_type count, value_type ch) -> basic_string_builder &
 Appends additional characters to the string.
 
auto append (const basic_string_builder &str) -> basic_string_builder &
 Appends additional characters to the string.
 
auto append (const basic_string_builder &str, size_type pos) -> basic_string_builder &
 Appends additional characters to the string.
 
auto append (const basic_string_builder &str, size_type pos, size_type count) -> basic_string_builder &
 Appends additional characters to the string.
 
auto append (const_pointer s, size_type count) -> basic_string_builder &
 Appends additional characters to the string.
 
auto append (const_pointer s) -> basic_string_builder &
 Appends additional characters to the string.
 
template<class input_iterator_t>
auto append (input_iterator_t first, input_iterator_t last) -> basic_string_builder &
 Appends additional characters to the string.
 
auto append (std::initializer_list< value_type > ilist) -> basic_string_builder &
 Appends additional characters to the string.
 
template<class ... args_t>
auto append_format (const xtd::basic_string< char_t > &format, args_t &&... args) -> basic_string_builder &
 Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a corresponding argument in a parameters.
 
template<class collection_t>
auto append_join (const xtd::basic_string< char_t > &separator, const collection_t &values) -> basic_string_builder &
 Concatenates and appends the members of a collection, using the specified separator between each member.
 
template<class collection_t>
auto append_join (value_type separator, const collection_t &values) -> basic_string_builder &
 Concatenates and appends the members of a collection, using the specified xtd::basic_string_builder::value_type separator between each member.
 
auto append_line () -> basic_string_builder &
 Appends the default line terminator to the end of the current xtd::text::basic_string_builder object.
 
auto append_line (const xtd::basic_string< char_t > &value) -> basic_string_builder &
 Appends a copy of the specified string followed by the default line terminator to the end of the current xtd::text::basic_string_builder object.
 
auto clear () -> basic_string_builder &
 Removes all characters from the current xtd::text::basic_string_builder instance.
 
auto copy_to (xtd::size source_index, xtd::array< value_type > &destination, xtd::size destination_index, xtd::size destination_count) const -> void
 Copies the characters from a specified segment of this instance to a specified segment of a destination xtd::text::basic_string_builder::value_type array.
 
auto equals (const object &obj) const noexcept -> bool override
 Determines whether this instance and a specified object, which must also be a xtd::text::basic_string_builder object, have the same value.
 
auto equals (const basic_string_builder &value) const noexcept -> bool override
 Determines whether this instance and another specified xtd::text::basic_string_builder object have the same value.
 
auto ensure_capacity (size_type capacity) -> size_type
 Ensures that the capacity of this instance of xtd::text::basic_string_builder is at least the specified value.
 
virtual auto get_base_type () const noexcept -> const base_type &
 Returns the underlying base type.
 
auto get_hash_code () const noexcept -> xtd::size override
 Returns the hash code for this basic_string_builder.
 
auto insert (size_type index, const xtd::basic_string< char_t > &value) -> basic_string_builder &
 Inserts a string into this instance at the specified character position.
 
auto insert (size_type index, const xtd::basic_string< char_t > &value, size_type count) -> basic_string_builder &
 Inserts one or more copies of a specified string into this instance at the specified character position.
 
auto insert (size_type index, xtd::boolean value) -> basic_string_builder &
 Inserts the string representation of a boolean value into this instance at the specified character position.
 
auto insert (size_type index, xtd::byte value) -> basic_string_builder &
 Inserts the string representation of a specified 8-bit unsigned integer into this instance at the specified character position.
 
auto insert (size_type index, xtd::decimal value) -> basic_string_builder &
 Inserts the string representation of a specified 8decimal into this instance at the specified character position.
 
auto insert (size_type index, double value) -> basic_string_builder &
 Inserts the string representation of a specified double into this instance at the specified character position.
 
auto insert (size_type index, xtd::single value) -> basic_string_builder &
 Inserts the string representation of a specified single into this instance at the specified character position.
 
auto insert (size_type index, xtd::int16 value) -> basic_string_builder &
 Inserts the string representation of a specified 16-bit signed integer into this instance at the specified character position.
 
auto insert (size_type index, xtd::int32 value) -> basic_string_builder &
 Inserts the string representation of a specified 32-bit signed integer into this instance at the specified character position.
 
auto insert (size_type index, xtd::int64 value) -> basic_string_builder &
 Inserts the string representation of a specified 64-bit signed integer into this instance at the specified character position.
 
auto insert (size_type index, xtd::sbyte value) -> basic_string_builder &
 Inserts the string representation of a specified 8-bit signed integer into this instance at the specified character position.
 
auto insert (size_type index, xtd::uint16 value) -> basic_string_builder &
 Inserts the string representation of a specified 16-bit unsigned integer into this instance at the specified character position.
 
auto insert (size_type index, xtd::uint32 value) -> basic_string_builder &
 Inserts the string representation of a specified 32-bit unsigned integer into this instance at the specified character position.
 
auto insert (size_type index, xtd::uint64 value) -> basic_string_builder &
 Inserts the string representation of a specified 64-bit unsigned integer into this instance at the specified character position.
 
auto insert (size_type index, value_type value) -> basic_string_builder &
 Inserts the string representation of a specified Unicode character into this instance at the specified character position.
 
auto insert (size_type index, value_type value, size_type repeat_count) -> basic_string_builder &
 Inserts a specified number of copies of the string representation of a Unicode character to this instance at the specified character position.
 
template<class object_t>
auto insert (size_type index, object_t value) -> basic_string_builder &
 Inserts the string representation of a specified object into this instance at the specified character position.
 
auto insert (size_type index, size_type count, value_type ch) -> basic_string_builder &
 Inserts characters into the string.
 
auto insert (size_type index, const basic_string_builder &str, size_type s_index, size_type count) -> basic_string_builder &
 Inserts characters into the string.
 
auto replace (const xtd::basic_string< char_t > &old_value, const xtd::basic_string< char_t > &new_value) noexcept -> basic_string_builder &
 Inserts characters into the string.
 
auto replace (const_iterator first, const_iterator last, const basic_string_builder &str) -> basic_string_builder &
 Replaces, within a substring of this instance, all occurrences of a specified string with another specified string.
 
auto replace (size_type pos, size_type count, const basic_string_builder &str, size_type pos2) -> basic_string_builder &
 Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count, size())) or [first, last) with given characters.
 
auto replace (size_type pos, size_type count, const basic_string_builder &str, size_type pos2, size_type count2) -> basic_string_builder &
 Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count, size())) or [first, last) with given characters.
 
auto replace (size_type pos, size_type count, const_pointer cstr, size_type count2) -> basic_string_builder &
 Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count, size())) or [first, last) with given characters.
 
auto replace (const_iterator first, const_iterator last, const_pointer cstr) -> basic_string_builder &
 Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count, size())) or [first, last) with given characters.
 
auto replace (size_type pos, size_type count, size_type count2, value_type ch) -> basic_string_builder &
 Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count, size())) or [first, last) with given characters.
 
template<class input_iterator_t>
auto replace (const_iterator first, const_iterator last, input_iterator_t first2, input_iterator_t last2) -> basic_string_builder &
 Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count, size())) or [first, last) with given characters.
 

Additional Inherited Members

 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<class object_t>
xtd::unique_ptr_object< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
virtual xtd::string to_string () const
 Returns a xtd::string that represents the current object.
 
virtual bool equals (const type_t &) const noexcept=0
 Indicates whether the current object is equal to another object of the same type.
 
template<class object_a_t, class object_b_t>
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<class object_a_t, class object_b_t>
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

Member Typedef Documentation

◆ base_type

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
using xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::base_type

Represents the basic string base type.

Remarks
Is equal to std::basic_string<char_t, traits_t, allocator_t>.

◆ traits_type

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
using xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::traits_type

Represents the basic string traits type.

◆ value_type

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
using xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::value_type

Represents the basic string value type.

◆ allocator_type

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
using xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::allocator_type

Represents the basic string allocator type.

◆ size_type

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
using xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::size_type

Represents the basic string size type.

◆ difference_type

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
using xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::difference_type

Represents the basic string difference type.

◆ reference

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
using xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::reference

Represents the basic string referecne type.

◆ const_reference

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
using xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::const_reference

Represents the basic string const referecne type.

◆ pointer

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
using xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::pointer

Represents the basic string pointer type.

◆ const_pointer

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
using xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::const_pointer

Represents the basic string const pointer type.

◆ iterator

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
using xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::iterator

Represents the basic string iterator type.

Todo
replace xtd::ienumerable::iterator

◆ const_iterator

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
using xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::const_iterator

Represents the basic string const iterator type.

Todo
replace xtd::ienumerable::const_iterator

◆ reverse_iterator

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
using xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::reverse_iterator

Represents the basic string reverse iterator type.

◆ const_reverse_iterator

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
using xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::const_reverse_iterator

Represents the basic string const reverse iterator type.

Constructor & Destructor Documentation

◆ basic_string_builder() [1/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( )
default

Initializes a new instance of xtd::text::basic_string_builder.

Examples
The following example demonstrates how to call the xtd::text::basic_string_builder constructor with no parameters.
auto sb = string_builder();
xtd::text::basic_string_builder< char > string_builder
Represents a mutable string of characters of UTF-8 code units. This class cannot be inherited.
Definition string_builder.hpp:19

◆ basic_string_builder() [2/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( xtd::size capacity)
inline

Initializes a new instance of the xtd::text::basic_string_builder class using the specified capacity.

Parameters
capacityThe suggested starting size of this instance.
Exceptions
argument_out_of_range_exception`capacity` is greater than xtd::text::basic_string_builder::max_capacity.
Examples
The following example demonstrates how to call the xtd::text::basic_string_builder constructor with a specified capacity.
auto capacity = 255_z;
auto capacity() const noexcept -> size_type
Returns the number of characters that the string has currently allocated space for.
Definition basic_string_builder.hpp:351
Remarks
The capacity parameter defines the maximum number of characters that can be stored in the memory allocated by the current instance. Its value is assigned to the xtd::text::basic_string_builder::capacity property. If the number of characters to be stored in the current instance exceeds this capacity value, the xtd::text::basic_string_builder object allocates additional memory to store them.
The string value of this instance is set to xtd::string::empty_string. If capacity is zero, the implementation-specific default capacity is used.

◆ basic_string_builder() [3/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( xtd::size capacity,
xtd::size max_capacity )
inline

Initializes a new instance of the xtd::text::basic_string_builder class that starts with a specified capacity and can grow to a specified maximum.

Parameters
capacityThe suggested starting size of the xtd::text::basic_string_builder..
max_capacityThe maximum number of characters the current string can contain.
Exceptions
xtd::argument_out_of_range_exception`capacity` is greater than `max_capacity`.
Examples
The following example demonstrates how to call the xtd::text::basic_string_builder constructor with a specified capacity and maximum capacity.
auto capacity = 255_z;
auto max_capacity = 1024_z
auto max_capacity() const noexcept -> size_type
Returns the number of characters that the string has currently allocated space for.
Definition basic_string_builder.hpp:428
Remarks
The capacity parameter defines the maximum number of characters that can be stored in the memory allocated by the current instance. Its value is assigned to the xtd::text::basic_string_builder::capacity property. If the number of characters to be stored in the current instance exceeds this capacity value, the xtd::text::basic_string_builder object allocates additional memory to store them.
If capacity is zero, the implementation-specific default capacity is used.
The max_capacity parameter defines the maximum number of characters that the current instance can hold. Its value is assigned to the xtd::text::basic_string_builder::max_capacity property. If the number of characters to be stored in the current instance exceeds this max_capacity value, the xtd::text::basic_string_builder object does not allocate additional memory, but instead throws an exception.

◆ basic_string_builder() [4/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( const xtd::basic_string< value_type > & value)
inline

Initializes a new instance of the xtd::text::basic_string_builder class using the specified string.

Parameters
valueThe string used to initialize the value of the instance.
Examples
The following example demonstrates how to call the xtd::text::basic_string_builder constructor with the specified string.
auto initial_string = "Initial string."_s;
auto sb = string_builder(initial_string);

◆ basic_string_builder() [5/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( const xtd::basic_string< value_type > & value,
xtd::size capacity )
inline

Initializes a new instance of the xtd::text::basic_string_builder class using the specified string and capacity.

Parameters
valueThe string used to initialize the value of the instance.
capacityThe suggested starting size of the xtd::text::basic_string_builder.
Examples
The following example demonstrates how to call the xtd::text::basic_string_builder constructor with an initial string and a specified capacity.
auto initial_string = "Initial string."_s;
auto capacity = 255_z;
auto sb = string_builder(initial_string, capacity);
Remarks
The capacity parameter defines the maximum number of characters that can be stored in the memory allocated by the current instance. Its value is assigned to the xtd::text::basic_string_builder::capacity property. If the number of characters to be stored in the current instance exceeds this capacity value, the xtd::text::basic_string_builder object allocates additional memory to store them.

◆ basic_string_builder() [6/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( const xtd::basic_string< value_type > & value,
xtd::size start_index,
xtd::size length,
xtd::size capacity )
inline

Initializes a new instance of the xtd::text::basic_string_builder class from the specified substring and capacity.

Parameters
valueThe string that contains the substring used to initialize the value of this instance.
start_indexThe position within value where the substring begins.
lengthThe number of characters in the substring.
capacityThe suggested starting size of the xtd::text::basic_string_builder.
Exceptions
xtd::argument_out_of_range_exception`start_index` plus `length` is not a position within `value`.
Examples
The following example demonstrates how to call the xtd::text::basic_string_builder constructor with an initial string and a specified capacity.
auto initial_string = "Initial string for stringbuilder."_s;
auto start_index = 0_z;
auto length = 14_z;
auto capacity = 255_z;
auto sb = string_builder(initial_string, start_index, length, capacity);
auto length() const noexcept -> size_type
Gets or sets the length of the current xtd::text::basic_string_builder object.
Definition basic_string_builder.hpp:411
Remarks
The capacity parameter defines the maximum number of characters that can be stored in the memory allocated by the current instance. Its value is assigned to the xtd::text::basic_string_builder::capacity property. If the number of characters to be stored in the current instance exceeds this capacity value, the xtd::text::basic_string_builder object allocates additional memory to store them.

◆ basic_string_builder() [7/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( const allocator_type & allocator)
inlineexplicitnoexcept

Initializes a new instance of xtd::text::basic_string_builder with specified allocator.

Parameters
allocatorThe allocator to use for all memory allocations of this basic_string_builder.

◆ basic_string_builder() [8/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( const basic_string_builder< char_t, traits_t, allocator_t > & str)
inlinenoexcept

Initializes a new instance of xtd::text::basic_string_builder with specified string to copy.

Parameters
strThe string to copy.

◆ basic_string_builder() [9/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( const basic_string_builder< char_t, traits_t, allocator_t > & str,
const allocator_type & allocator )
inlinenoexcept

Initializes a new instance of xtd::text::basic_string_builder with specified string to copy and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this basic_string_builder.

◆ basic_string_builder() [10/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( const basic_string_builder< char_t, traits_t, allocator_t > & str,
xtd::size index )
inline

Initializes a new instance of xtd::text::basic_string_builder with specified substring at index.

Parameters
strThe string to copy.
indexThe index of the first substring character where start copy.
Exceptions
xtd::index_out_of_range_exception`index` is greater or equal than `str` size.

◆ basic_string_builder() [11/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( const basic_string_builder< char_t, traits_t, allocator_t > & str,
xtd::size index,
const allocator_type & allocator )
inline

Initializes a new instance of xtd::text::basic_string_builder with specified substring at index and allocator.

Parameters
strThe string to copy.
indexThe index of the first substring character where start copy.
allocatorThe allocator to use for all memory allocations of this basic_string_builder.
Exceptions
xtd::index_out_of_range_exception`index` is greater or equal than `str` size.

◆ basic_string_builder() [12/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( const basic_string_builder< char_t, traits_t, allocator_t > & str,
xtd::size index,
xtd::size count )
inline

Initializes a new instance of xtd::text::basic_string_builder with specified substring at index and count characters.

Parameters
strThe string to copy.
indexThe index of the first substring character where start copy.
countThe number of substring characters to copy.
Exceptions
xtd::index_out_of_range_exception`index` + `count`is greater or equal than `str` size.

◆ basic_string_builder() [13/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( const basic_string_builder< char_t, traits_t, allocator_t > & str,
xtd::size index,
xtd::size count,
const allocator_type & allocator )
inline

Initializes a new instance of xtd::text::basic_string_builder with specified substring at index, count characters and allocator.

Parameters
strThe string to copy.
indexThe index of the first substring character where start copy.
countThe number of substring characters to copy.
allocatorThe allocator to use for all memory allocations of this basic_string_builder.
Exceptions
xtd::index_out_of_range_exception`index` + `count`is greater or equal than `str` size.

◆ basic_string_builder() [14/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( basic_string_builder< char_t, traits_t, allocator_t > && str)
inlinenoexcept

Initializes a new instance of xtd::text::basic_string_builder with specified string to move.

Parameters
strThe basic_string_builder to move.

◆ basic_string_builder() [15/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( basic_string_builder< char_t, traits_t, allocator_t > && str,
const allocator_type & allocator )
inlinenoexcept

Initializes a new instance of xtd::text::basic_string_builder with specified string to move and allocator.

Parameters
strThe basic_string_builder to move.
allocatorThe allocator to use for all memory allocations of this basic_string_builder.

◆ basic_string_builder() [16/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( xtd::size count,
value_type character )
inline
Parameters
strThe string to copy.
countThe number of copies of character.
characterThe character copied.

◆ basic_string_builder() [17/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( xtd::size count,
value_type character,
const allocator_type & allocator )
inline

Initializes a new instance of xtd::text::basic_string_builder with specified count copies of character and specified allocator.

Parameters
countThe number of copies of character.
characterThe character copied.
allocatorThe allocator to use for all memory allocations of this basic_string_builder.

◆ basic_string_builder() [18/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( value_type character,
xtd::size count )
inline

Initializes a new instance of xtd::text::basic_string_builder with specified count copies of character.

Parameters
characterThe character copied.
countThe number of copies of character.

◆ basic_string_builder() [19/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( value_type character,
xtd::size count,
const allocator_type & allocator )
inline

Initializes a new instance of xtd::text::basic_string_builder with specified count copies of character and specified allocator.

Parameters
characterThe character copied.
countThe number of copies of character.
allocatorThe allocator to use for all memory allocations of this basic_string_builder.

◆ basic_string_builder() [20/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( const_pointer str)
inline

Initializes a new instance of xtd::text::basic_string_builder with specified string to copy.

Parameters
strThe string to copy.

◆ basic_string_builder() [21/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( const_pointer str,
const allocator_type & allocator )
inline

Initializes a new instance of xtd::text::basic_string_builder with specified string to copy, and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this basic_string_builder.

◆ basic_string_builder() [22/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( const_pointer str,
xtd::size count )
inline

Initializes a new instance of xtd::text::basic_string_builder with specified substring and count characters.

Parameters
countThe number of substring characters to copy.

◆ basic_string_builder() [23/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( const_pointer str,
xtd::size count,
const allocator_type & allocator )
inline

Initializes a new instance of xtd::text::basic_string_builder with specified substring, count characters and allocator.

Parameters
strThe string to copy.
countThe number of substring characters to copy.
allocatorThe allocator to use for all memory allocations of this basic_string_builder.

◆ basic_string_builder() [24/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( const std::basic_string< value_type > & str)
inlinenoexcept

Initializes a new instance of xtd::text::basic_string_builder with specified string to copy.

Parameters
strThe string to copy.

◆ basic_string_builder() [25/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( const std::basic_string< value_type > & str,
const allocator_type & allocator )
inlinenoexcept

Initializes a new instance of xtd::text::basic_string_builder with specified string to copy and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this basic_string_builder.

◆ basic_string_builder() [26/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
template<class input_iterator_t>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( input_iterator_t first,
input_iterator_t last )
inline

Initializes a new instance of xtd::text::basic_string_builder with specified first and last iterators of substring.

Parameters
firstThe first iterator of substring.
lastThe first iterator of substring.

◆ basic_string_builder() [27/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
template<class input_iterator_t>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( input_iterator_t first,
input_iterator_t last,
const allocator_type & allocator )
inline

Initializes a new instance of xtd::text::basic_string_builder with specified first and last iterators of substring and allocator.

Parameters
firstThe first iterator of substring.
lastThe first iterator of substring.
allocatorThe allocator to use for all memory allocations of this basic_string_builder.

◆ basic_string_builder() [28/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( std::initializer_list< value_type > il)
inline

Initializes a new instance of xtd::text::basic_string_builder with specified initializer list.

Parameters
ilThe initializer list to fill.

◆ basic_string_builder() [29/29]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::basic_string_builder ( std::initializer_list< value_type > il,
const allocator_type & allocator )
inline

Initializes a new instance of xtd::text::basic_string_builder with specified initializer list and allocator.

Parameters
ilThe initializer list to fill.
allocatorThe allocator to use for all memory allocations of this basic_string_builder.

Member Function Documentation

◆ begin() [1/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::begin ( ) const -> const_iterator
inlinenodiscard

Returns an iterator to the first character of the string.

Returns
Iterator to the first character.

◆ begin() [2/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::begin ( ) -> iterator
inlinenodiscard

Returns an iterator to the first character of the string.

Returns
Iterator to the first character.

◆ c_str()

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::c_str ( ) const -> const_pointer
inlinenodiscardnoexcept

Returns a pointer to a null-terminated character array with data equivalent to those stored in the string.

Returns
Pointer to the underlying character storage.
Remarks
The pointer is such that the range [c_str(), c_str() + size()] is valid and the values in it correspond to the values stored in the string with an additional null character after the last position.
The pointer obtained from c_str() may be invalidated by:
Writing to the character array accessed through c_str() is undefined behavior.
c_str() and data() perform the same function.

◆ capacity() [1/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::capacity ( ) const -> size_type
inlinenodiscardnoexcept

Returns the number of characters that the string has currently allocated space for.

Returns
Capacity of the currently allocated storage, i.e. the storage available for storing elements.

◆ capacity() [2/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::capacity ( size_type value) -> basic_string_builder&
inline

Sets the number of characters that the string has currently allocated space for.

Parameters
valueCapacity of the currently allocated storage, i.e. the storage available for storing elements.

◆ cbegin()

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::cbegin ( ) const -> const_iterator
inlinenodiscard

Returns an iterator to the first character of the string.

Returns
Iterator to the first character.

◆ chars() [1/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::chars ( ) const -> const base_type&
inlinenodiscardnoexcept

Returns a reference to the underlying base type.

Returns
Reference to the underlying base type.

◆ chars() [2/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::chars ( ) -> base_type&
inlinenodiscardnoexcept

Returns a reference to the underlying base type.

Returns
Reference to the underlying base type.

◆ cend()

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::cend ( ) const -> const_iterator
inlinenodiscard

Returns an iterator to the character following the last character of the string. This character acts as a placeholder, attempting to access it results in undefined behavior.

Returns
Iterator to the character following the last character.

◆ data() [1/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::data ( ) const -> const_pointer
inlinenodiscardnoexcept

Returns a pointer to the underlying array serving as character storage. The pointer is such that the range [data(), data() + size()] is valid and the values in it correspond to the values stored in the string.

Returns
A pointer to the underlying character storage.
Remarks
The pointer obtained from data() may be invalidated by:
  • Passing a non-const reference to the string to any standard library function, or
  • Calling non-const member functions on the string, excluding operator[](), at(), front(), back(), begin(), end(), rbegin(), rend().
    1. Modifying the character array accessed through the const overload of data has undefined behavior.
    2. Modifying the past-the-end null terminator stored at data() + size() to any value other than char_t() has undefined behavior.

◆ data() [2/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::data ( ) -> pointer
inlinenodiscardnoexcept

Returns a pointer to the underlying array serving as character storage. The pointer is such that the range [data(), data() + size()] is valid and the values in it correspond to the values stored in the string.

Returns
A pointer to the underlying character storage.
Remarks
The pointer obtained from data() may be invalidated by:
  • Passing a non-const reference to the string to any standard library function, or
  • Calling non-const member functions on the string, excluding operator[](), at(), front(), back(), begin(), end(), rbegin(), rend().
    1. Modifying the character array accessed through the const overload of data has undefined behavior.
    2. Modifying the past-the-end null terminator stored at data() + size() to any value other than char_t() has undefined behavior.

◆ empty()

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::empty ( ) const -> bool
inlinenodiscardnoexcept

Checks if the string has no characters, i.e. whether begin() == end().

Returns
true if the string is empty; otherwise false.

◆ end() [1/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::end ( ) const -> const_iterator
inlinenodiscard

Returns an iterator to the character following the last character of the string. This character acts as a placeholder, attempting to access it results in undefined behavior.

Returns
Iterator to the character following the last character.

◆ end() [2/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::end ( ) -> iterator
inlinenodiscard

Returns an iterator to the character following the last character of the string. This character acts as a placeholder, attempting to access it results in undefined behavior.

Returns
Iterator to the character following the last character.

◆ length() [1/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::length ( ) const -> size_type
inlinenodiscardnoexcept

Gets or sets the length of the current xtd::text::basic_string_builder object.

Returns
The length of this instance.
Remarks
The length of a xtd::text::basic_string_builder object is defined by its number of xtd::text::basic_string_builder::value_type objects.
Like the xtd::basic_string::length property, the xtd::text::basic_string_builder::length property indicates the length of the current string object. Unlike the xtd::basic_string::length property, which is read-only, the xtd::text::basic_string_builder::length property allows you to modify the length of the string stored to the xtd::text::basic_string_builder object.
If the specified length is less than the current length, the current xtd::text::basic_string_builder object is truncated to the specified length. If the specified length is greater than the current length, the end of the string value of the current xtd::text::basic_string_builder object is padded with the Unicode NULL character (U+0000).
If the specified length is greater than the current capacity, xtd::text::basic_string_builder::capacity increases so that it is greater than or equal to the specified length.
The xtd::text::basic_string_builder::length property returns the number of xtd::text::basic_string_builder::value_type objects in this instance, not the number of Unicode characters. The reason is that a Unicode character might be represented by more than one xtd::text::basic_string_builder::value_type.

◆ length() [2/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::length ( size_type value) -> basic_string_builder&
inlinenoexcept

Sets or sets the length of the current xtd::text::basic_string_builder object.

Parameters
valueThe length of this instance.
Returns
A reference to this instance after the length has been modified.
Exceptions
xtd::argument_out_of_range_exceptionThe value specified for a set operation is less than zero or greater than xtd::text::basic_string_builder::max_capacity.
Remarks
The length of a xtd::text::basic_string_builder object is defined by its number of xtd::text::basic_string_builder::value_type objects.
Like the xtd::basic_string::length property, the xtd::text::basic_string_builder::length property indicates the length of the current string object. Unlike the xtd::basic_string::length property, which is read-only, the xtd::text::basic_string_builder::length property allows you to modify the length of the string stored to the xtd::text::basic_string_builder object.
If the specified length is less than the current length, the current xtd::text::basic_string_builder object is truncated to the specified length. If the specified length is greater than the current length, the end of the string value of the current xtd::text::basic_string_builder object is padded with the Unicode NULL character (U+0000).
If the specified length is greater than the current capacity, xtd::text::basic_string_builder::capacity increases so that it is greater than or equal to the specified length.
The xtd::text::basic_string_builder::length property returns the number of xtd::text::basic_string_builder::value_type objects in this instance, not the number of Unicode characters. The reason is that a Unicode character might be represented by more than one xtd::text::basic_string_builder::value_type.

◆ max_capacity()

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::max_capacity ( ) const -> size_type
inlinenodiscardnoexcept

Returns the number of characters that the string has currently allocated space for.

Returns
Capacity of the currently allocated storage, i.e. the storage available for storing elements.

◆ size()

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::size ( ) const -> size_type
inlinenodiscardnoexcept

Returns the number of char_t elements in the string, i.e. std::distance(begin(), end()).

Returns
The number of char_t elements in the string.

◆ append() [1/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( const xtd::basic_string< char_t > & value) -> basic_string_builder&
inline

Appends a copy of the specified string to this instance.

Parameters
valueThe string to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The xtd::text::basic_string_builder::append (const xtd::basic_string&) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates.
auto flag = false;
sb.append("The value of the flag is ").append(flag).append(".");
console::write_line(sb.to_string());
// The example displays the following output:
//
// The value of the flag is `false`.
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
If value is empty, no changes are made.
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [2/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( const xtd::basic_string< char_t > & value,
size_type start_index,
size_type count ) -> basic_string_builder&
inline

Appends a copy of a specified substring to this instance.

Parameters
valueThe string that contains the substring to append.
start_indexThe starting position of the substring within value.
countThe number of characters in value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
-or-
`start_index` + `count` is greater than the length of `value`.
Remarks
This method appends the specified range of characters in value to the current instance. If value is empty and start_index and count are both zero, no changes are made.
The xtd::text::basic_string_builder::append (const xtd::basic_string&, size_type, size_type) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates.
auto str = "First;George Washington;1789;1797"_s;
auto index = 0_z;
auto length = str.index_of(';', index);
sb.append(str, index, length).append(" President of the United States: ");
index += length + 1;
length = str.index_of(';', index) - index;
sb.append(str, index, length).append(", from ");
index += length + 1;
length = str.index_of(';', index) - index;
sb.append(str, index, length).append(" to ");
index += length + 1;
sb.append(str, index, str.length() - index);
// The example displays the following output:
//
// First President of the United States: George Washington, from 1789 to 1797
constexpr size_type length() const noexcept
Returns the length of the current read_only_span.
Definition read_only_span.hpp:229
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [3/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( xtd::boolean value) -> basic_string_builder&
inline

Appends the string representation of a specified boolean value to this instance.

Parameters
valueThe boolean value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The xtd::text::basic_string_builder::append (xtd::boolean) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates.
auto flag = false;
sb.append("The value of the flag is ").append(flag).append(".");
console::write_line(sb.to_string());
// The example displays the following output:
//
// The value of the flag is `false`.
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [4/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( xtd::byte value) -> basic_string_builder&
inline

Appends the string representation of a specified 8-bit unsigned value to this instance.

Parameters
valueThe 8-bit unsigned value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The xtd::text::basic_string_builder::append (xtd::byte) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates.
auto bytes = array<byte> {16, 132, 27, 253};
for (auto value : bytes)
sb.append(value).append(" ");
console::write_line("The byte array: {0}", sb.to_string());
// The example displays the following output:
//
// The byte array: 16 132 27 253
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [5/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( xtd::decimal value) -> basic_string_builder&
inline

Appends the string representation of a specified decimal value to this instance.

Parameters
valueThe decimal value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The xtd::text::basic_string_builder::append (xtd::decimal) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates.
auto value = 1346.19l;
sb.append('*', 5).append(value).append('*', 5);
// The example displays the following output:
//
// *****1346.19*****
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [6/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( double value) -> basic_string_builder&
inline

Appends the string representation of a specified double value to this instance.

Parameters
valueThe double value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The xtd::text::basic_string_builder::append (double) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates.
auto value = 1346.19;
sb.append('*', 5).append(value).append('*', 5);
// The example displays the following output:
//
// *****1346.19*****
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [7/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( xtd::single value) -> basic_string_builder&
inline

Appends the string representation of a specified single value to this instance.

Parameters
valueThe single value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The xtd::text::basic_string_builder::append (xtd::single) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates.
auto value = 1346.19f;
sb.append('*', 5).append(value).append('*', 5);
// The example displays the following output:
//
// *****1346.19*****
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [8/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( xtd::int16 value) -> basic_string_builder&
inline

Appends the string representation of a specified 16-bit signed integer value to this instance.

Parameters
valueThe 16-bit signed value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The xtd::text::basic_string_builder::append (xtd::int16) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates.
auto value = 1346_s16;
sb.append('*', 5).append(value).append('*', 5);
// The example displays the following output:
//
// *****1346*****
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [9/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( xtd::int32 value) -> basic_string_builder&
inline

Appends the string representation of a specified 32-bit signed integer value to this instance.

Parameters
valueThe 32-bit signed value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The xtd::text::basic_string_builder::append (xtd::int32) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates.
auto value = 1346;
sb.append('*', 5).append(value).append('*', 5);
// The example displays the following output:
//
// *****1346*****
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [10/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( xtd::int64 value) -> basic_string_builder&
inline

Appends the string representation of a specified 64-bit signed integer value to this instance.

Parameters
valueThe 64-bit signed value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The xtd::text::basic_string_builder::append (xtd::int64) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates.
auto value = 1346_s64;
sb.append('*', 5).append(value).append('*', 5);
// The example displays the following output:
//
// *****1346*****
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [11/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( xtd::sbyte value) -> basic_string_builder&
inline

Appends the string representation of a specified 8-bit signed integer value to this instance.

Parameters
valueThe 8-bit signed integer value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The xtd::text::basic_string_builder::append (xtd::sbyte) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates.
auto bytes = array<sbyte> {16, 132, 27, 253};
for (auto value : bytes)
sb.append(value).append(" ");
console::write_line("The byte array: {0}", sb.to_string());
// The example displays the following output:
//
// The byte array: 16 132 27 253
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [12/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( xtd::uint16 value) -> basic_string_builder&
inline

Appends the string representation of a specified 16-bit unsigned integer value to this instance.

Parameters
valueThe 16-bit unsigned value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The xtd::text::basic_string_builder::append (xtd::uint16) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates.
auto value = 1346_u16;
sb.append('*', 5).append(value).append('*', 5);
// The example displays the following output:
//
// *****1346*****
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [13/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( xtd::uint32 value) -> basic_string_builder&
inline

Appends the string representation of a specified 32-bit unsigned integer value to this instance.

Parameters
valueThe 32-bit unsigned value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The xtd::text::basic_string_builder::append (xtd::uint32) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates.
auto value = 1346_u32;
sb.append('*', 5).append(value).append('*', 5);
// The example displays the following output:
//
// *****1346*****
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [14/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( xtd::uint64 value) -> basic_string_builder&
inline

Appends the string representation of a specified 64-bit unsigned integer value to this instance.

Parameters
valueThe 64-bit unsigned value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The xtd::text::basic_string_builder::append (xtd::uint64) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates.
auto value = 1346_u64;
sb.append('*', 5).append(value).append('*', 5);
// The example displays the following output:
//
// *****1346*****
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [15/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( value_type value) -> basic_string_builder&
inline

Appends the string representation of a specified xtd::text::basic_string_builder::value_type value to this instance.

Parameters
valueThe xtd::text::basic_string_builder::value_type value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The xtd::text::basic_string_builder::append (xtd::text::basic_string_builder::value_type) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates.
auto str = "Characters in a string.";
for (auto ch : str)
sb.append(" '").append(ch).append("' ");
console::write_line("Characters in the string:");
// The example displays the following output:
//
// Characters in the string:
// 'C' 'h' 'a' 'r' 'a' 'c' 't' 'e' 'r' 's' ' ' 'i' 'n' ' ' 'a' ' ' 's' 't' 'r' 'i' 'n' 'g' '.'
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [16/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( value_type value,
size_type repeat_count ) -> basic_string_builder&
inline

Appends a specified number of copies of the string representation of a Unicode character to this instance.

Parameters
valueThe character to append.
repeat_countThe number of times to append value.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The xtd::text::basic_string_builder::append (xtd::text::basic_string_builder::value_type, xtd::text::basic_string_builder::size_type) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates.
auto value = 1346.19;
sb.append('*', 5).append(value).append('*', 5);
// The example displays the following output:
//
// *****1346.19*****
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [17/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
template<class object_t>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( object_t value) -> basic_string_builder&
inline

Appends the string representation of a specified object to this instance.

Template Parameters
object_tThe type of object to append.
Parameters
valueThe object to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The xtd::text::basic_string_builder::append (object_t) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a xtd::text::basic_string_builder object, as the following example illustrates. It defines a dog class, creates a dog object, and makes three calls to the xtd::text::basic_string_builder::append method to create a string that contains the dog's name and breed.
#include <xtd/xtd>
class dog : public istringable<dog> {
private:
string dog_breed;
string dog_name;
public:
dog(const string& name, const string& breed) : dog_breed(breed), dog_name(name) {}
const string& breed() const noexcept {return dog_breed;}
const string& name() const noexcept {return dog_name;}
string to_string() const noexcept override {return dog_name;}
};
auto main() -> int {
auto dog1 = dog {"Mocka", "American Shepherd"};
sb.append(dog1).append(", breed: ").append(dog1.breed());
console::write_line(sb);
}
// This code produces the following output :
//
// Mocka, breed: American Shepherd
Provides a way to represent the current object as a string.
Definition istringable.hpp:26
virtual xtd::string to_string() const =0
Gets a string that represents the current object.
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [18/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( size_type count,
value_type ch ) -> basic_string_builder&
inline

Appends additional characters to the string.

Parameters
countThe number of characters to append.
chThe character value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Appends count copies of character ch.
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [19/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( const basic_string_builder< char_t, traits_t, allocator_t > & str) -> basic_string_builder&
inline

Appends additional characters to the string.

Parameters
strThe string to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Appends string str.
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [20/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( const basic_string_builder< char_t, traits_t, allocator_t > & str,
size_type pos ) -> basic_string_builder&
inline

Appends additional characters to the string.

Parameters
strThe string to append.
posThe index of the first character to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Appends a substring [pos, pos + count) of str.
If the requested substring lasts past the end of the string, or if count == npos, the appended substring is [pos, size()).
If pos > str.length(), std::out_of_range is thrown.
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [21/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( const basic_string_builder< char_t, traits_t, allocator_t > & str,
size_type pos,
size_type count ) -> basic_string_builder&
inline

Appends additional characters to the string.

Parameters
strThe string to append.
posThe index of the first character to append.
countThe number of characters to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Appends a substring [pos, pos + count) of str.
If the requested substring lasts past the end of the string, or if count == npos, the appended substring is [pos, size()).
If pos > str.length(), std::out_of_range is thrown.
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [22/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( const_pointer s,
size_type count ) -> basic_string_builder&
inline

Appends additional characters to the string.

Parameters
sThe pointer to the character string to append.
countThe number of characters to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Appends characters in the range [s, s + count). This range can contain null characters.
If [s, s + count) is not a valid range, the behavior is undefined.
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [23/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( const_pointer s) -> basic_string_builder&
inline

Appends additional characters to the string.

Parameters
sThe pointer to the character string to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Appends the null-terminated character string pointed to by s, as if by append(s, traits_t::length(s)).
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append() [24/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
template<class input_iterator_t>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( input_iterator_t first,
input_iterator_t last ) -> basic_string_builder&
inline

Appends additional characters to the string.

Parameters
firstThe first iterator of the range of characters to append.
lastThe last iterator of the range of characters to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Appends characters in the range [first, last).
This overload only participates in overload resolution if input_iterator_t qualifies as a LegacyInputIterator.
The capacity of this instance is adjusted as needed.

◆ append() [25/25]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append ( std::initializer_list< value_type > ilist) -> basic_string_builder&
inline

Appends additional characters to the string.

Parameters
ilistThe initializer list with the characters to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Appends characters from the initializer list ilist.
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append_format()

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
template<class ... args_t>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append_format ( const xtd::basic_string< char_t > & format,
args_t &&... args ) -> basic_string_builder&
inline

Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a corresponding argument in a parameters.

Template Parameters
...args_tTypes of the values to format.
Parameters
formatA composite format string.
argsArguments to format.
Returns
A reference to this instance with format appended. Each format item in format is replaced by the string representation of the corresponding object argument.
Exceptions
xtd::format_exception`format` is invalid.
Remarks
This method uses the composite formatting feature of the xtd framework to convert the value of an object to its text representation and embed that representation in the current xtd::text::basic_string_builder object.
The format parameter consists of optional zero or more runs of text intermixed with zero or more indexed placeholders, called format items, that correspond to objects in the parameter list of this method. The formatting process replaces each format item with the string representation of the corresponding object.
The syntax of a format item is as follows: {[index][,length][:format_string]}
Elements in square brackets are optional. The following table describes each element.
Element Description
index The optional zero-based position in the parameter list of the object to be formatted. If there is no parameter in the index position, a xtd::format_exception is thrown.
length The minimum number of characters in the string representation of the parameter. If positive, the parameter is right-aligned; if negative, it is left-aligned.
:format_string A standard or custom format string that is supported by the parameter.
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append_join() [1/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
template<class collection_t>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append_join ( const xtd::basic_string< char_t > & separator,
const collection_t & values ) -> basic_string_builder&
inline

Concatenates and appends the members of a collection, using the specified separator between each member.

Parameters
separatorThe string to use as a separator. separator is included in the concatenated and appended strings only if values has more than one element.
valuesA collection that contains the objects to concatenate and append to the current instance of the string builder.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append_join() [2/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
template<class collection_t>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append_join ( value_type separator,
const collection_t & values ) -> basic_string_builder&
inline

Concatenates and appends the members of a collection, using the specified xtd::basic_string_builder::value_type separator between each member.

Parameters
separatorThe xtd::basic_string_builder::value_type to use as a separator. separator is included in the concatenated and appended strings only if values has more than one element.
valuesA collection that contains the objects to concatenate and append to the current instance of the string builder.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append_line() [1/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append_line ( ) -> basic_string_builder&
inline

Appends the default line terminator to the end of the current xtd::text::basic_string_builder object.

Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ append_line() [2/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::append_line ( const xtd::basic_string< char_t > & value) -> basic_string_builder&
inline

Appends a copy of the specified string followed by the default line terminator to the end of the current xtd::text::basic_string_builder object.

Parameters
valueThe string to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
The capacity of this instance is adjusted as needed.
Notes to Callers
When you instantiate the xtd::text::basic_string_builder object by calling the xtd::text::basic_string_builder::basic_string_builder(xtd::size, xtd::size) constructor, both the length and the capacity of the xtd::text::basic_string_builder instance can grow beyond the value of its xtd::text::basic_string_builder::max_capacity property. This can occur particularly when you call the xtd::text::basic_string_builder::append and xtd::text::basic_string_builder::append_format methods to append small strings.

◆ clear()

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::clear ( ) -> basic_string_builder&
inline

Removes all characters from the current xtd::text::basic_string_builder instance.

Returns
An object whose xtd::text::basic_string_builder::length is 0 (zero).
Remarks
xtd::text::basic_string_builder::clear is a convenience method that is equivalent to setting the xtd::text::basic_string_builder::length property of the current instance to 0 (zero).
All pointers, references, and iterators are invalidated.

◆ copy_to()

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::copy_to ( xtd::size source_index,
xtd::array< value_type > & destination,
xtd::size destination_index,
xtd::size destination_count ) const -> void
inline

Copies the characters from a specified segment of this instance to a specified segment of a destination xtd::text::basic_string_builder::value_type array.

Parameters
source_indexThe starting position in this instance where characters will be copied from. The index is zero-based.
destinationThe array where characters will be copied.
destination_indexThe starting position in destination where characters will be copied. The index is zero-based.
destination_countThe number of characters to be copied.
Exceptions
xtd::argument_out_of_range_exception`source_index` is greater than length
-or-
`destination_index` + 'destination_count' greater than destination size.
Remarks
The xtd::text::basic_string_builder::copy_to method is intended to be used in the rare situation when you need to efficiently copy successive sections of a xtd::text::basic_string_builder object to an array. The array should be a fixed size, preallocated, reusable, and possibly globally accessible.
For example, your code could populate a xtd::text::basic_string_builder object with a large number of characters then use the xtd::text::basic_string_builder::copy_to method to copy small, successive pieces of the xtd::text::basic_string_builder object to an array where the pieces are processed. When all the data in the xtd::text::basic_string_builder object is processed, the size of the xtd::text::basic_string_builder object is set to zero and the cycle is repeated.

◆ equals() [1/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::equals ( const object & obj) const -> bool
inlinenodiscardoverridevirtualnoexcept

Determines whether this instance and a specified object, which must also be a xtd::text::basic_string_builder object, have the same value.

Parameters
objThe basic_string_builder to compare to this instance.
Returns
true if obj is a xtd::text::basic_string_builder and its value is the same as this instance; otherwise, false.

Reimplemented from xtd::object.

◆ equals() [2/2]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::equals ( const basic_string_builder< char_t, traits_t, allocator_t > & value) const -> bool
inlinenodiscardoverridenoexcept

Determines whether this instance and another specified xtd::text::basic_string_builder object have the same value.

Parameters
valueThe basic_string_builder to compare to this instance.
Returns
true if the value of the value parameter is the same as the value of this instance; otherwise, false.
Remarks
This method performs an ordinal (case-sensitive) comparison.

◆ ensure_capacity()

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::ensure_capacity ( size_type capacity) -> size_type
inline

Ensures that the capacity of this instance of xtd::text::basic_string_builder is at least the specified value.

Parameters
capacityThe minimum capacity to ensure.
Returns
The new capacity of this instance.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed Enlarging the value of this instance would exceed MaxCapacity.max_capacity.
Remarks
If the current capacity is less than the capacity parameter, memory for this instance is reallocated to hold at least capacity number of characters; otherwise, no memory is changed.

◆ get_base_type()

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
virtual auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::get_base_type ( ) const -> const base_type&
inlinenodiscardvirtualnoexcept

Returns the underlying base type.

Returns
The underlying base type.

◆ get_hash_code()

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::get_hash_code ( ) const -> xtd::size
inlinenodiscardoverridevirtualnoexcept

Returns the hash code for this basic_string_builder.

Returns
A hash code.

Reimplemented from xtd::object.

◆ insert() [1/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
const xtd::basic_string< char_t > & value ) -> basic_string_builder&
inline

Inserts a string into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe string to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [2/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
const xtd::basic_string< char_t > & value,
size_type count ) -> basic_string_builder&
inline

Inserts one or more copies of a specified string into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe string to insert.
countThe number of times to insert value.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [3/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
xtd::boolean value ) -> basic_string_builder&
inline

Inserts the string representation of a boolean value into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [4/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
xtd::byte value ) -> basic_string_builder&
inline

Inserts the string representation of a specified 8-bit unsigned integer into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [5/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
xtd::decimal value ) -> basic_string_builder&
inline

Inserts the string representation of a specified 8decimal into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [6/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
double value ) -> basic_string_builder&
inline

Inserts the string representation of a specified double into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [7/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
xtd::single value ) -> basic_string_builder&
inline

Inserts the string representation of a specified single into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [8/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
xtd::int16 value ) -> basic_string_builder&
inline

Inserts the string representation of a specified 16-bit signed integer into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [9/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
xtd::int32 value ) -> basic_string_builder&
inline

Inserts the string representation of a specified 32-bit signed integer into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [10/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
xtd::int64 value ) -> basic_string_builder&
inline

Inserts the string representation of a specified 64-bit signed integer into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [11/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
xtd::sbyte value ) -> basic_string_builder&
inline

Inserts the string representation of a specified 8-bit signed integer into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [12/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
xtd::uint16 value ) -> basic_string_builder&
inline

Inserts the string representation of a specified 16-bit unsigned integer into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exceptionEnlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [13/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
xtd::uint32 value ) -> basic_string_builder&
inline

Inserts the string representation of a specified 32-bit unsigned integer into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [14/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
xtd::uint64 value ) -> basic_string_builder&
inline

Inserts the string representation of a specified 64-bit unsigned integer into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [15/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
value_type value ) -> basic_string_builder&
inline

Inserts the string representation of a specified Unicode character into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [16/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
value_type value,
size_type repeat_count ) -> basic_string_builder&
inline

Inserts a specified number of copies of the string representation of a Unicode character to this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe character to insert.
repeat_countThe number of times to append value.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [17/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
template<class object_t>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
object_t value ) -> basic_string_builder&
inline

Inserts the string representation of a specified object into this instance at the specified character position.

Template Parameters
object_tThe type of object to insert.
Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Existing characters are shifted to make room for the new text. The capacity is adjusted as needed.
This instance of xtd::text::basic_string_builder is not changed if value is empty (its length is zero).
Notes to Callers
Calls to this method threw an xtd::argument_out_of_range_exception if inserting value would cause the object's total length to exceed xtd::text::basic_string_builder::max_capacity.

◆ insert() [18/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
size_type count,
value_type ch ) -> basic_string_builder&
inline

Inserts characters into the string.

Parameters
indexThe position at which the content will be inserted.
countThe number of characters to insert.
chThe character to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Inserts count copies of character ch at the position index.

◆ insert() [19/19]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::insert ( size_type index,
const basic_string_builder< char_t, traits_t, allocator_t > & str,
size_type s_index,
size_type count ) -> basic_string_builder&
inline

Inserts characters into the string.

Parameters
indexThe position at which the content will be inserted.
sThe pointer to the character string to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Inserts null-terminated character string pointed to by s at the position index. The length of the string is determined by the first null character using traits_t::length(s). auto insert(size_type index, const_pointer s) -> basic_string_builder& {return insert(index, basic_string_builder(s));} / @brief Inserts characters into the string. / @param index The position at which the content will be inserted. / @param s The pointer to the character string to insert. / @param count The number of characters to insert. / @return A reference to this instance after the insert operation has completed. / @exception xtd::argument_out_of_range_exceptionindexis greater than the length of this instance.<rr>-or-<br>Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity. / @remarks Inserts the characters in the range [s,s + count) at the positionindex. The range can contain null characters. auto insert(size_type index, const_pointer s, size_type count) -> basic_string_builder& {return insert(index, basic_string_builder(s, count));} / @brief Inserts characters into the string. / @param index The position at which the content will be inserted. / @param str The string to insert. / @return A reference to this instance after the insert operation has completed. / @exception xtd::argument_out_of_range_exceptionindexis greater than the length of this instance.<rr>-or-<br>Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity. / @remarks Inserts stringstrat the positionindex. auto insert(size_type index, const basic_string_builder & str) -> basic_string_builder& {return insert(index, str, 0, str.length());} / @brief Inserts characters into the string. / @param index The position at which the content will be inserted. / @param str The string to insert. / @param s_index The position of the first character in str to insert. / @param count The number of characters to insert. / @return A reference to this instance after the insert operation has completed. / @exception xtd::argument_out_of_range_exceptionindexis greater than the length of this instance.<rr>-or-<br>Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity. / @remarks Inserts a string, obtained bystr.substr(s_index, count)at the positionindex.

◆ replace() [1/8]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::replace ( const xtd::basic_string< char_t > & old_value,
const xtd::basic_string< char_t > & new_value ) -> basic_string_builder&
inlinenoexcept

Inserts characters into the string.

Parameters
indexThe position at which the content will be inserted.
strThe string to insert.
s_indexThe position of the first character in str to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
xtd::argument_out_of_range_exception`index` is greater than the length of this instance.<rr>-or-
Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity.
Remarks
Inserts a string, obtained by str.substr(s_index, str.length()) at the position `index. auto insert(size_type index, const basic_string_builder & str, size_type s_index) -> basic_string_builder& {return insert(index, str.chars_, s_index, str.length() - s_index);}

/ Removes the specified range of characters from this instance. /

Parameters
start_indexThe zero-based position in this instance where removal begins. /
lengthThe number of characters to remove. /
Returns
A reference to this instance after the excise operation has completed. /
Exceptions
xtd::argument_out_of_range_exceptionIf `start_index` + `length` is greater than the length of this instance. /
Remarks
The current method removes the specified range of characters from the current instance. The characters at (start_index + length) are moved to start_index, and the string value of the current instance is shortened by length. The capacity of the current instance is unaffected. /
Warning
The xtd::text::basic_string_builder::remove method modifies the value of the current xtd::text::basic_string_builder instance and returns that instance. It does not create and return a new xtd::text::basic_string_builder object. auto remove(size_type start_index, size_type length) -> basic_string_builder& {return erase(start_index, length);}

/ Replaces all occurrences of a specified character in this instance with another specified character. /

Parameters
old_charThe character to replace. /
new_charThe character that replaces old_char. /
Returns
A reference to this instance with old_char replaced by new_char. /
Remarks
This method performs an ordinal, case-sensitive comparison to identify occurrences of old_char in the current instance. The size of the current xtd::text::basic_string_builder instance is unchanged after the replacement. auto replace(value_type old_char, value_type new_char) noexcept -> basic_string_builder& {return replace(old_char, new_char, 0, length());} / Replaces, within a substring of this instance, all occurrences of a specified character with another specified character. /
Parameters
old_charThe character to replace. /
new_charThe character that replaces old_char. /
start_indexThe position in this instance where the substring begins. /
countThe length of the substring. /
Returns
A reference to this instance with old_char replaced by new_char in the range from start_ index to start_index + count - 1. /
Remarks
This method performs an ordinal, case-sensitive comparison to identify occurrences of old_char in the current instance. The size of the current xtd::text::basic_string_builder object is unchanged after the replacement. auto replace(value_type old_char, value_type new_char, size_type start_index, size_type count) -> basic_string_builder& {return replace(xtd::basic_string<char_t>(old_char, 1), xtd::basic_string<char_t>(new_char, 1), start_index, count);} / Replaces all occurrences of a specified string in this instance with another specified string. /
Parameters
old_valueThe string to replace. /
new_valueThe string that replaces 'old_value. @return A reference to this instance with all instances ofold_valuereplaced bynew_value. @exception xtd::argument_out_of_range_exception Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity. @remarks This method performs an ordinal, case-sensitive comparison to identify occurrences ofold_valuein the current instance. Ifnew_valueis xtd::basic_string::empty_string, all occurrences ofold_value` are removed.

◆ replace() [2/8]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::replace ( const_iterator first,
const_iterator last,
const basic_string_builder< char_t, traits_t, allocator_t > & str ) -> basic_string_builder&
inline

Replaces, within a substring of this instance, all occurrences of a specified string with another specified string.

Parameters
old_valueThe string to replace.
new_valueThe string that replaces 'old_value. / @param start_index The position in this instance where the substring begins. / @param count The length of the substring. / @return A reference to this instance with all instances ofold_valuereplaced bynew_valuein the range fromstart_indextostart_index+count- 1. / @exception xtd::argument_out_of_range_exceptionstart_indexpluscountindicates a character position not within this instance.<br>-or-<br>Enlarging the value of this instance would exceed xtd::text::basic_string_builder::max_capacity. / @remarks This method performs an ordinal, case-sensitive comparison to identify occurrences ofold_valuein the substring of this current instance. Ifnew_valueis xtd::basic_string::empty_string, all occurrences ofold_value` are removed. auto replace(const xtd::basic_string<char_t>& old_value, const xtd::basic_string<char_t>& new_value, size_type start_index, size_type count) -> basic_string_builder& { if (start_index > length() || start_index + count > length()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range); auto old_size = old_value.length(); auto new_size = new_value.length(); auto index = xtd::size {0}; while (true) { index = chars_.find(old_value, index); if (index == npos || index >= start_index + count) break; if (index >= start_index) { if (old_size == new_size) replace(index, old_size, new_value); else { chars_.erase(index, old_value.length()); insert(index, new_value); } } index += new_value.length(); } return self_; }

/ Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count, size())) or [first, last) with given characters. /

Parameters
posThe start of the substring that is going to be replaced. /
countThe length of the substring that is going to be replaced. /
strThe string to use for replacement. /
Returns
This current instance of xtd::text::basic_string_builder. /
Remarks
Those characters are replaced with str. auto replace(size_type pos, size_type count, const basic_string_builder & str) -> basic_string_builder& { if (pos > size() || pos + count > size()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range); chars_.replace(pos, count, str); return self_; } / Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count, size())) or [first, last) with given characters. /
Parameters
firstThe first itrator of range of characters that is going to be replaced. /
lastThe last itrator of range of characters that is going to be replaced. /
strThe string to use for replacement. /
Returns
This current instance of xtd::text::basic_string_builder. /
Remarks
Those characters are replaced with str. /
If [begin(), first) or [first, last`) is not a valid range, the behavior is undefined.

◆ replace() [3/8]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::replace ( size_type pos,
size_type count,
const basic_string_builder< char_t, traits_t, allocator_t > & str,
size_type pos2 ) -> basic_string_builder&
inline

Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count, size())) or [first, last) with given characters.

Parameters
posThe start of the substring that is going to be replaced.
countThe length of the substring that is going to be replaced.
strThe string to use for replacement.
pos2The start of the substring to replace with.
Returns
This current instance of xtd::text::basic_string_builder.
Remarks
Those characters are replaced with a substring [pos2, std::min(pos2 + count2, str.length())) of str.

◆ replace() [4/8]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::replace ( size_type pos,
size_type count,
const basic_string_builder< char_t, traits_t, allocator_t > & str,
size_type pos2,
size_type count2 ) -> basic_string_builder&
inline

Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count, size())) or [first, last) with given characters.

Parameters
posThe start of the substring that is going to be replaced.
countThe length of the substring that is going to be replaced.
strThe string to use for replacement.
pos2The start of the substring to replace with.
count2The number of characters to replace with.
Returns
This current instance of xtd::text::basic_string_builder.
Remarks
Those characters are replaced with a substring [pos2, std::min(pos2 + count2, str.length())) of str.

◆ replace() [5/8]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::replace ( size_type pos,
size_type count,
const_pointer cstr,
size_type count2 ) -> basic_string_builder&
inline

Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count, size())) or [first, last) with given characters.

Parameters
posThe start of the substring that is going to be replaced.
countThe length of the substring that is going to be replaced.
cstrThe pointer to the character string to use for replacement.
Returns
This current instance of xtd::text::basic_string_builder.
Remarks
Those characters are replaced with the characters in the range [cstr, cstr + count2).
If [cstr, cstr + count2) is not a valid range, the behavior is undefined.

◆ replace() [6/8]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::replace ( const_iterator first,
const_iterator last,
const_pointer cstr ) -> basic_string_builder&
inline

Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count, size())) or [first, last) with given characters.

Parameters
firstThe first itrator of range of characters that is going to be replaced.
lastThe last itrator of range of characters that is going to be replaced.
cstrThe pointer to the character string to use for replacement.
count2The number of characters to replace with.
Returns
This current instance of xtd::text::basic_string_builder.
Remarks
Those characters are replaced with the characters in the range [cstr, cstr + count2).
If [cstr, cstr + count2) is not a valid range, the behavior is undefined.
If [begin(), first) or [first, last) is not a valid range, the behavior is undefined. auto replace(const_iterator first, const_iterator last, const_pointer cstr, size_type count2) -> basic_string_builder& { chars_.replace(first, last, cstr, count2); return self_; } / @brief Replaces the characters in the range [begin() + pos,begin() + std::min(pos + count, size())) or [first,last) with given characters. / @param pos The start of the substring that is going to be replaced. / @param count The length of the substring that is going to be replaced. / @param cstr The pointer to the character string to use for replacement. / @return This current instance of xtd::text::basic_string_builder. / @remarks Those characters are replaced with the characters in the range [cstr,cstr + Traits::length(cstr)). auto replace(size_type pos, size_type count, const_pointer cstr) -> basic_string_builder& { chars_.replace(pos, count, cstr); return self_; } / @brief Replaces the characters in the range [begin() + pos,begin() + std::min(pos + count, size())) or [first,last) with given characters. / @param first The first itrator of range of characters that is going to be replaced. / @param last The last itrator of range of characters that is going to be replaced. / @return This current instance of xtd::text::basic_string_builder. / @remarks Those characters are replaced with the characters in the range [cstr,cstr + Traits::length(cstr)). / @remarks If [begin(),first) or [first, last) is not a valid range, the behavior is undefined.

◆ replace() [7/8]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::replace ( size_type pos,
size_type count,
size_type count2,
value_type ch ) -> basic_string_builder&
inline

Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count, size())) or [first, last) with given characters.

Parameters
posThe start of the substring that is going to be replaced.
countThe length of the substring that is going to be replaced.
count2The number of characters to replace with.
Returns
This current instance of xtd::text::basic_string_builder.
Remarks
Those characters are replaced with count2 copies of ch.

◆ replace() [8/8]

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
template<class input_iterator_t>
auto xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::replace ( const_iterator first,
const_iterator last,
input_iterator_t first2,
input_iterator_t last2 ) -> basic_string_builder&
inline

Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count, size())) or [first, last) with given characters.

Parameters
firstThe first itrator of range of characters that is going to be replaced.
lastThe last itrator of range of characters that is going to be replaced.
count2The number of characters to replace with.
Returns
This current instance of xtd::text::basic_string_builder.
Remarks
Those characters are replaced with count2 copies of ch.
If [begin(), first) or [first, last) is not a valid range, the behavior is undefined. auto replace(const_iterator first, const_iterator last, size_type count2, value_type ch) -> basic_string_builder& { chars_.replace(first, last, count2, ch); return self_; } / @brief Replaces the characters in the range [begin() + pos,begin() + std::min(pos + count, size())) or [first,last) with given characters. / @param first The first itrator of range of characters that is going to be replaced. / @param last The last itrator of range of characters that is going to be replaced. / @param first2 The first itrator of range of characters to use for replacement. / @param last2 The last itrator of range of characters to use for replacement. / @return This current instance of xtd::text::basic_string_builder. / @remarks Those characters are replaced with the characters in the range [first2,last2) as if byreplace(first, last, basic_string(first2, last2, get_allocator())). / @remarks If [begin(),first) or [first, last) is not a valid range, the behavior is undefined.

Member Data Documentation

◆ npos

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
size_type xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::npos
inlinestaticconstexpr

Represents a value that is not a valid position in a collection.

Remarks
This constant is typically used to indicate the absence of an index or a failed search operation. It is equivalent to the maximum value of xtd::size.
Examples
auto str = string_builder {"hello"};
if (str.index_of('g') == str.npos)
console::write_line("Value not found");

◆ bpos

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::size xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::bpos
inlinestaticconstexpr

Represents the index of the first valid element in a collection.

Remarks
Unlike xtd::npos (which means "no position"), xtd::bpos points to the first accessible element of a collection. It is equivalent to 0.
Examples
auto str = string_builder {"hello"};
console::write_line(str[bpos]); // Prints 'h'
console::write_line(str[bpos + 1]); // Prints 'e'
constexpr xtd::size bpos
Represents the index of the firsy valid element in a collection.
Definition bpos.hpp:25

◆ epos

template<class char_t, class traits_t = std::char_traits<char_t>, class allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
xtd::size xtd::text::basic_string_builder< char_t, traits_t, allocator_t >::epos
inlinestaticconstexpr

Represents the index of the last valid element in a collection.

Remarks
Unlike xtd::npos (which means "no position"), xtd::epos points to the last accessible element of a collection. It is equivalent to items.count() - 1.
Note
This constant is provided for readability and convenience. For example, items[xtd::epos] directly accesses the last element without manually subtracting one from the collection count.
Remarks
The epos is equivalent to ~1_z. With bitwise operator the code is more concise.
Examples
auto str = string_builder {"hello"};
console::write_line(str[epos]); // Prints 'o'
console::write_line(str[epos - 1]); // Prints 'l'
constexpr xtd::size epos
Represents the index of the last valid element in a collection.
Definition epos.hpp:33
The wollowing exemple shows the same example with bitwise operator as index.
auto str = string {"hello"};
console::write_line(str[~1_z]); // Prints 'o'
console::write_line(str[~2_z]); // Prints 'l'

The documentation for this class was generated from the following file: