xtd 0.2.0
Loading...
Searching...
No Matches
basic_string_builder.h
Go to the documentation of this file.
1
4#pragma once
5#include "../basic_string.h"
6#include "../argument_exception.h"
7#include "../argument_out_of_range_exception.h"
8#include "../environment.h"
9#include "../index_out_of_range_exception.h"
10#include "../null_pointer_exception.h"
11#include <iterator>
14namespace xtd {
16 namespace text {
34 template<typename char_t, typename traits_t = std::char_traits<char_t>, typename allocator_t = xtd::collections::generic::helpers::allocator<char_t>>
35 class basic_string_builder final : public object, public xtd::iequatable<basic_string_builder<char_t, traits_t, allocator_t>> {
36 public:
38
42 using base_type = std::basic_string<char_t, traits_t, allocator_t>;
44 using traits_type = typename base_type::traits_type;
46 using value_type = typename base_type::value_type;
48 using allocator_type = typename base_type::allocator_type;
50 using size_type = typename base_type::size_type;
52 using difference_type = typename base_type::difference_type;
54 using reference = typename base_type::reference;
56 using const_reference = typename base_type::const_reference;
58 using pointer = typename base_type::pointer;
60 using const_pointer = typename base_type::const_pointer;
63 using iterator = typename base_type::iterator;
66 using const_iterator = typename base_type::const_iterator;
68 using reverse_iterator = typename base_type::reverse_iterator;
70 using const_reverse_iterator = typename base_type::const_reverse_iterator;
72
74
77 inline static constexpr size_type npos = base_type::npos;
79
81
137 basic_string_builder(const xtd::basic_string<value_type>& value, xtd::size capacity) : chars_(value.chars()) {this->capacity(capacity);}
154 basic_string_builder(const xtd::basic_string<value_type>& value, xtd::size start_index, xtd::size length, xtd::size capacity) : chars_(value.substring(start_index, length).chars()) {this->capacity(capacity);}
155
158 explicit basic_string_builder(const allocator_type& allocator) noexcept : chars_(allocator) {}
159
162 basic_string_builder(const basic_string_builder& str) noexcept : chars_(str.chars_) {}
166 basic_string_builder(const basic_string_builder& str, const allocator_type& allocator) noexcept : chars_(str.chars_, allocator) {}
167
173 if (index > str.size()) throw xtd::argument_out_of_range_exception(csf_);
174 chars_ = base_type(str.chars_, index);
175 }
182 if (index > str.size()) throw xtd::argument_out_of_range_exception(csf_);
183 chars_ = base_type(str.chars_, index, allocator);
184 }
185
192 if (index + count > str.size()) throw xtd::argument_out_of_range_exception(csf_);
193 chars_ = base_type(str.chars_, index, count);
194 }
201 basic_string_builder(const basic_string_builder& str, xtd::size index, xtd::size count, const allocator_type& allocator) {
202 if (index + count > str.size()) throw xtd::argument_out_of_range_exception(csf_);
203 chars_ = base_type(str.chars_, index, count, allocator);
204 }
205
208 basic_string_builder(basic_string_builder&& str) noexcept : chars_(std::move(str.chars_)) {}
212 basic_string_builder(basic_string_builder&& str, const allocator_type& allocator) noexcept : chars_(std::move(str.chars_), allocator) {}
213
217 basic_string_builder(xtd::size count, value_type character) : chars_(count, character) {}
222 basic_string_builder(xtd::size count, value_type character, const allocator_type& allocator) : chars_(count, character, allocator) {}
223
227 basic_string_builder(value_type character, xtd::size count) : chars_(count, character) {}
232 basic_string_builder(value_type character, xtd::size count, const allocator_type& allocator) : chars_(count, character, allocator) {}
233
236 basic_string_builder(const_pointer str) { // Can't be explicit by design.
237 if (str == null) throw xtd::null_pointer_exception(csf_);
238 chars_ = base_type(str);
239 }
244 if (str == null) throw xtd::null_pointer_exception(csf_);
245 chars_ = base_type(str, allocator);
246 }
247
251 if (str == null) throw xtd::null_pointer_exception(csf_);
252 chars_ = base_type(str, count);
253 }
258 basic_string_builder(const_pointer str, xtd::size count, const allocator_type& allocator) : chars_(allocator) {
259 if (str == null) throw xtd::null_pointer_exception(csf_);
260 chars_ = base_type(str, count);
261 }
262
265 basic_string_builder(const std::basic_string<value_type>& str) noexcept : chars_(str) {}; // Can't be explicit by design.
269 basic_string_builder(const std::basic_string<value_type>& str, const allocator_type& allocator) noexcept : chars_(str, allocator) {}
270
274 template<typename input_iterator_t>
275 basic_string_builder(input_iterator_t first, input_iterator_t last) : chars_(first, last) {}
280 template<typename input_iterator_t>
281 basic_string_builder(input_iterator_t first, input_iterator_t last, const allocator_type& allocator) : chars_(first, last, allocator) {}
282
285 basic_string_builder(std::initializer_list<value_type> il) : chars_(il) {}
286
290 basic_string_builder(std::initializer_list<value_type> il, const allocator_type& allocator) : chars_(il, allocator) {}
292
294
299 const_reference back() const {return operator[](size() - 1);}
303 reference back() {return operator[](size() - 1);}
304
307 const_iterator begin() const {return chars_.begin();}
310 iterator begin() {return chars_.begin();}
311
320 const_pointer c_str() const noexcept {return chars_.c_str();}
321
324 size_type capacity() const noexcept {return chars_.capacity();}
328 reserve(value);
329 return *this;
330 }
331
334 const_iterator cbegin() const {return chars_.cbegin();}
335
338 const base_type& chars() const noexcept {return chars_;}
339
342 base_type& chars() noexcept {return chars_;}
343
346 const_iterator cend() const {return chars_.cend();}
347
355 const_pointer data() const noexcept {return chars_.data();}
363 pointer data() noexcept {return chars_.data();}
364
367 bool empty() const noexcept {return chars_.empty();}
368
371 const_iterator end() const {return chars_.end();}
374 iterator end() {return chars_.end();}
375
379 const_reference front() const {return operator[](0);}
384
392 size_type length() const noexcept {return chars_.size();}
403 if (value != length()) resize(value);
404 return *this;
405 }
406
409 size_type max_capacity() const noexcept {return max_capacity_;}
410
413 size_type max_size() const noexcept {return chars_.max_size();}
414
417 size_type size() const noexcept {return chars_.size();}
419
421
474 basic_string_builder& append(const xtd::basic_string<char_t>& value, size_type start_index, size_type count) {return append(basic_string_builder {value, start_index, count});}
513 basic_string_builder& append(xtd::byte value) {return append_format("{}", value);}
551 basic_string_builder& append(double value) {return append_format("{}", value);}
727 basic_string_builder& append(value_type value) {return append(1_z, value);}
747 basic_string_builder& append(value_type value, size_type repeat_count) {return append(repeat_count, value);}
748
750 basic_string_builder& append(xtd::slong value) {return append_format("{}", value);}
751 basic_string_builder& append(xtd::ulong value) {return append_format("{}", value);}
753
764 template<typename object_t>
765 basic_string_builder& append(object_t value) {return append_format("{}", value);}
784 basic_string_builder& append(const basic_string_builder& str) {return append(str, 0, str.length());}
796 basic_string_builder& append(const basic_string_builder& str, size_type pos) {return append(str, pos, str.length() - pos);}
810 if (length() + count > max_capacity()) throw argument_out_of_range_exception {csf_};
811 if (pos > str.size() || pos + count > str.length()) throw xtd::argument_out_of_range_exception {csf_};
812 chars_.append(str.chars_, pos, count);
813 return *this;
814 }
843 template<class input_iterator_t>
844 basic_string_builder& append(input_iterator_t first, input_iterator_t last) {
845 if (length() + std::distance(first, last) > max_capacity()) throw argument_out_of_range_exception {csf_};
846 return append(basic_string_builder {first, last});
847 }
856 basic_string_builder& append(std::initializer_list<value_type> ilist) {return append(basic_string_builder {ilist});}
857
877 template<typename ...args_t>
878 basic_string_builder& append_format(const xtd::basic_string<char_t>& format, args_t&& ... args) {return append(xtd::basic_string<char_t>::format(format, std::forward<args_t>(args)...));}
879
888 template<typename collection_t >
898 template<typename collection_t >
900
902 template<typename value_t>
903 basic_string_builder& append_join(const xtd::basic_string<char_t>& separator, const std::initializer_list<value_t>& values) {return append_join(separator, std::vector<value_t>(values));}
904 template<typename value_t>
905 basic_string_builder& append_join(value_type separator, const std::initializer_list<value_t>& values) {return append_join(separator, std::vector<value_t>(values));}
907
923
927 const_reference at(size_type pos) const {return operator [](pos);}
931 reference at(size_type pos) {return operator [](pos);}
932
938 chars_.clear();
939 return *this;
940 }
941
960 int32 compare(const basic_string_builder& str) const {return chars_.compare(str);}
982 int32 compare(size_type pos1, size_type count1, const basic_string_builder& str) const {return chars_.compare(pos1, count1, str);}
1006 int32 compare(size_type pos1, size_type count1, const basic_string_builder& str, size_type pos2) const {return chars_.compare(pos1, count1, str, pos2);}
1031 int32 compare(size_type pos1, size_type count1, const basic_string_builder& str, size_type pos2, size_type count2) const {return chars_.compare(pos1, count1, str, pos2, count2);}
1050 int32 compare(const_pointer s) const {return chars_.compare(s);}
1072 int32 compare(size_type pos1, size_type count1, const_pointer s) const {return chars_.compare(pos1, count1, s);}
1095 int32 compare(size_type pos1, size_type count1, const_pointer s, size_type count2) const {return chars_.compare(pos1, count1, s, count2);}
1096
1102 size_type copy(pointer dest, size_type count) const {
1103 if (count > length()) throw xtd::argument_out_of_range_exception {csf_};
1104 return chars_.copy(dest, count);
1105 }
1112 size_type copy(pointer dest, size_type count, size_type pos) const {
1113 if (pos > length() || pos + count > length()) throw xtd::argument_out_of_range_exception {csf_};
1114 return chars_.copy(dest, count, pos);
1115 }
1116
1125 void copy_to(xtd::size source_index, xtd::array<value_type>& destination, xtd::size destination_index, xtd::size destination_count) const {
1126 if (source_index > length() || source_index + destination_count > length()) throw xtd::argument_out_of_range_exception {csf_};
1127 if (destination_index >= destination.size() || destination_index + destination_count > destination.size()) throw xtd::argument_out_of_range_exception {csf_};
1128 copy(destination.data() + destination_index, destination_count, source_index);
1129 }
1130
1134 bool equals(const object& obj) const noexcept override {return dynamic_cast<const basic_string_builder*>(&obj) && equals(static_cast<const basic_string_builder&>(obj));}
1139 bool equals(const basic_string_builder& value) const noexcept override {return chars_ == value.chars_;}
1140
1147 if (this->capacity() < capacity) this->capacity(capacity);
1148 return this->capacity();
1149 }
1150
1155 chars_.erase();
1156 return *this;
1157 }
1163 if (index > length()) throw xtd::argument_out_of_range_exception {csf_};
1164 chars_.erase(index);
1165 return *this;
1166 }
1173 if (index > length() || index + count > length()) throw xtd::argument_out_of_range_exception {csf_};
1174 chars_.erase(index, count);
1175 return *this;
1176 }
1182 iterator erase(const_iterator position) {return chars_.erase(position);}
1189 iterator erase(const_iterator first, const_iterator last) {return chars_.erase(first, last);}
1190
1194 size_type find(const basic_string_builder& str) const {return chars_.find(str);}
1200 size_type find(const basic_string_builder& str, size_type pos) const {return chars_.find(str, pos);}
1208 size_type find(const_pointer s, size_type pos, size_type count) const {return chars_.find(s, pos, count);}
1214 size_type find(const_pointer s) const {return chars_.find(s);}
1221 size_type find(const_pointer s, size_type pos) const {return chars_.find(s, pos);}
1226 size_type find(value_type ch) const {return chars_.find(ch);}
1232 size_type find(value_type ch, size_type pos) const {return chars_.find(ch, pos);}
1233
1238 size_type find_first_of(const basic_string_builder& str) const {return chars_.find_first_of(str);}
1244 size_type find_first_of(const basic_string_builder& str, size_type pos) const {return chars_.find_first_of(str, pos);}
1252 size_type find_first_of(const_pointer s, size_type pos, size_type count) const {return chars_.find_first_of(s, pos, count);}
1258 size_type find_first_of(const_pointer s) const {return chars_.find_first_of(s);}
1265 size_type find_first_of(const_pointer s, size_type pos) const {return chars_.find_first_of(s, pos);}
1270 size_type find_first_of(value_type ch) const {return chars_.find_first_of(ch);}
1276 size_type find_first_of(value_type ch, size_type pos) const {return chars_.find_first_of(ch, pos);}
1277
1282 size_type find_first_not_of(const basic_string_builder& str) const {return chars_.find_first_not_of(str);}
1288 size_type find_first_not_of(const basic_string_builder& str, size_type pos) const {return chars_.find_first_not_of(str, pos);}
1296 size_type find_first_not_of(const_pointer s, size_type pos, size_type count) const {return chars_.find_first_not_of(s, pos, count);}
1302 size_type find_first_not_of(const_pointer s) const {return chars_.find_first_not_of(s);}
1309 size_type find_first_not_of(const_pointer s, size_type pos) const {return chars_.find_first_not_of(s, pos);}
1314 size_type find_first_not_of(value_type ch) const {return chars_.find_first_not_of(ch);}
1320 size_type find_first_not_of(value_type ch, size_type pos) const {return chars_.find_first_not_of(ch, pos);}
1321
1326 size_type find_last_of(const basic_string_builder& str) const {return chars_.find_last_of(str);}
1332 size_type find_last_of(const basic_string_builder& str, size_type pos) const {return chars_.find_last_of(str, pos);}
1340 size_type find_last_of(const_pointer s, size_type pos, size_type count) const {return chars_.find_last_of(s, pos, count);}
1346 size_type find_last_of(const_pointer s) const {return chars_.find_last_of(s);}
1353 size_type find_last_of(const_pointer s, size_type pos) const {return chars_.find_last_of(s, pos);}
1358 size_type find_last_of(value_type ch) const {return chars_.find_last_of(ch);}
1364 size_type find_last_of(value_type ch, size_type pos) const {return chars_.find_last_of(ch, pos);}
1365
1370 size_type find_last_not_of(const basic_string_builder& str) const {return chars_.find_last_not_of(str);}
1376 size_type find_last_not_of(const basic_string_builder& str, size_type pos) const {return chars_.find_last_not_of(str, pos);}
1384 size_type find_last_not_of(const_pointer s, size_type pos, size_type count) const {return chars_.find_last_not_of(s, pos, count);}
1390 size_type find_last_not_of(const_pointer s) const {return chars_.find_last_not_of(s);}
1397 size_type find_last_not_of(const_pointer s, size_type pos) const {return chars_.find_last_not_of(s, pos);}
1402 size_type find_last_not_of(value_type ch) const {return chars_.find_last_not_of(ch);}
1408 size_type find_last_not_of(value_type ch, size_type pos) const {return chars_.find_last_not_of(ch, pos);}
1409
1412 allocator_type get_allocator() const {return chars_.get_allocator();}
1413
1416 virtual const base_type& get_base_type() const noexcept {return chars_;}
1417
1420 xtd::size get_hash_code() const noexcept override {return xtd::hash_code::combine(chars_);}
1421
1431 basic_string_builder& insert(size_type index, const xtd::basic_string<char_t>& value) {return insert(index, basic_string_builder {value}, 0, value.length());}
1442 basic_string_builder& insert(size_type index, const xtd::basic_string<char_t>& value, size_type count) {return insert(index, basic_string_builder {value}, 0, count);}
1482 basic_string_builder& insert(size_type index, double value) {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1572 basic_string_builder& insert(size_type index, value_type value) {return insert(index, 1, value);}
1583 basic_string_builder& insert(size_type index, value_type value, size_type repeat_count) {return insert(index, repeat_count, value);}
1584
1586 basic_string_builder& insert(size_type index, xtd::slong value) {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1587 basic_string_builder& insert(size_type index, xtd::ulong value) {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1589
1600 template<typename object_t>
1601 basic_string_builder& insert(size_type index, object_t value) {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1610 if (index > length()) throw argument_out_of_range_exception {csf_};
1611 if (length() + count > max_capacity()) throw argument_out_of_range_exception {csf_};
1612 chars_.insert(index, count, ch);
1613 return *this;
1614 }
1636 basic_string_builder& insert(size_type index, const basic_string_builder& str) {return insert(index, str, 0, str.length());}
1646 if (length() + count > max_capacity()) throw argument_out_of_range_exception {csf_};
1647 if (index > length()) throw argument_out_of_range_exception {csf_};
1648 if (s_index > str.size() || s_index + count > str.length()) throw xtd::argument_out_of_range_exception {csf_};
1649 chars_.insert(index, str.chars_, s_index, count);
1650 return *this;
1651 }
1659 basic_string_builder& insert(size_type index, const basic_string_builder& str, size_type s_index) {return insert(index, str.chars_, s_index, str.length() - s_index);}
1666 iterator insert(const_iterator pos, value_type ch) {return insert(pos, 1, ch);}
1675 if (static_cast<size_type>(std::distance(cbegin(), pos)) > length()) throw argument_out_of_range_exception {csf_};
1676 if (length() + count > max_capacity()) throw argument_out_of_range_exception {csf_};
1677 return chars_.insert(pos, count, ch);
1678 }
1687 template<typename input_iterator_t>
1688 iterator insert( const_iterator pos, input_iterator_t first, input_iterator_t last) {
1689 if (static_cast<size_type>(std::distance(cbegin(), pos)) > length()) throw argument_out_of_range_exception {csf_};
1690 if (length() + std::distance(first, last) > max_capacity()) throw argument_out_of_range_exception {csf_};
1691 return chars_.insert(pos, first, last);
1692 }
1699 iterator insert(const_iterator pos, std::initializer_list<value_type> ilist) {
1700 if (static_cast<size_type>(std::distance(cbegin(), pos)) > length()) throw argument_out_of_range_exception {csf_};
1701 return chars_.insert(pos, ilist);
1702 }
1703
1706 void pop_back() {chars_.pop_back();}
1707
1710 void push_back(value_type ch) {chars_.push_back(ch);}
1711
1719 basic_string_builder& remove(size_type start_index, size_type length) {return erase(start_index, length);}
1720
1726 basic_string_builder& replace(value_type old_char, value_type new_char) noexcept {return replace(old_char, new_char, 0, length());}
1734 basic_string_builder& replace(value_type old_char, value_type new_char, size_type start_index, size_type count) {return replace(xtd::basic_string<char_t>(1, old_char), xtd::basic_string<char_t>(1, new_char), start_index, count);}
1741 basic_string_builder& replace(const xtd::basic_string<char_t>& old_value, const xtd::basic_string<char_t>& new_value) noexcept {return replace(old_value, new_value, 0, length());}
1751 if (start_index > length() || start_index + count > length()) throw argument_out_of_range_exception {csf_};
1752 auto old_size = old_value.size();
1753 auto new_size = new_value.size();
1754 auto index = xtd::size {0};
1755 while (true) {
1756 index = find(old_value, index);
1757 if (index == npos || index >= start_index + count) break;
1758 if (index >= start_index) {
1759 if (old_size == new_size) replace(index, old_size, new_value);
1760 else {
1761 erase(index, old_value.size());
1762 insert(index, new_value);
1763 }
1764 }
1765 index += new_value.size();
1766 }
1767 return *this;
1768 }
1769
1777 if (pos > size() || pos + count > size()) throw argument_out_of_range_exception {csf_};
1778 chars_.replace(pos, count, str);
1779 return *this;
1780 }
1789 chars_.replace(first, last, str);
1790 return *this;
1791 }
1800 if (pos > size() || pos + count > size()) throw argument_out_of_range_exception {csf_};
1801 if (pos2 > str.size()) throw argument_out_of_range_exception {csf_};
1802 chars_.replace(pos, count, str, pos2);
1803 return *this;
1804 }
1814 if (pos > size() || pos + count > size()) throw argument_out_of_range_exception {csf_};
1815 if (pos2 > str.size() || pos2 + count2 > str.size()) throw argument_out_of_range_exception {csf_};
1816 chars_.replace(pos, count, str, pos2, count2);
1817 return *this;
1818 }
1827 if (pos > size() || pos + count > size()) throw argument_out_of_range_exception {csf_};
1828 chars_.replace(pos, count, cstr, count2);
1829 return *this;
1830 }
1841 chars_.replace(first, last, cstr, count2);
1842 return *this;
1843 }
1851 chars_.replace(pos, count, cstr);
1852 return *this;
1853 }
1861 chars_.replace(first, last, cstr);
1862 return *this;
1863 }
1871 if (pos > size() || pos + count > size()) throw argument_out_of_range_exception {csf_};
1872 chars_.replace(pos, count, count2, ch);
1873 return *this;
1874 }
1883 chars_.replace(first, last, count2, ch);
1884 return *this;
1885 }
1894 template<typename input_iterator_t>
1895 basic_string_builder& replace(const_iterator first, const_iterator last, input_iterator_t first2, input_iterator_t last2) {
1896 chars_.replace(first, last, first2, last2);
1897 return *this;
1898 }
1906 basic_string_builder& replace(const_iterator first, const_iterator last, std::initializer_list<value_type> ilist) {
1907 chars_.replace(first, last, ilist);
1908 return *this;
1909 }
1910
1916 void reserve(size_type new_cap) {
1917 if (new_cap > max_capacity_) throw xtd::argument_out_of_range_exception {csf_};
1918 if (new_cap <= capacity()) return;
1919 chars_.reserve(new_cap);
1920 }
1921
1926 void resize(size_type count) {chars_.resize(count);}
1932 void resize(size_type count, value_type ch) {chars_.resize(count, ch);}
1933
1937 size_type rfind(const basic_string_builder& str) const {return chars_.rfind(str);}
1943 size_type rfind(const basic_string_builder& str, size_type pos) const {return chars_.rfind(str, pos);}
1951 size_type rfind(const_pointer s, size_type pos, size_type count) const {return chars_.rfind(s, pos, count);}
1957 size_type rfind(const_pointer s) const {return chars_.rfind(s);}
1964 size_type rfind(const_pointer s, size_type pos) const {return chars_.rfind(s, pos);}
1969 size_type rfind(value_type ch) const {return chars_.rfind(ch);}
1975 size_type rfind(value_type ch, size_type pos) const {return chars_.rfind(ch, pos);}
1976
1980 void shrink_to_fit() {chars_.shrink_to_fit();}
1981
1986 basic_string_builder substr() const {return chars_.substr();}
1993 if (pos > size()) throw argument_out_of_range_exception {csf_};
1994 return chars_.substr(pos);
1995 }
2003 if (pos > size() || pos + count > size()) throw argument_out_of_range_exception {csf_};
2004 return chars_.substr(pos, count);
2005 }
2006
2009 void swap(basic_string_builder& other) noexcept {chars_.swap(other.chars_);}
2010
2014 //xtd::string to_string() const noexcept override {return __xtd_convert_to_string<char>(chars_);}
2015 xtd::string to_string() const noexcept override {return xtd::string {chars_};}
2017
2019
2021
2023
2025
2032 if (index >= length()) throw xtd::index_out_of_range_exception(csf_);
2033 return chars_[index];
2034 }
2040 if (index >= length()) throw xtd::index_out_of_range_exception(csf_);
2041 return chars_[index];
2042 }
2043
2046 virtual operator const base_type&() const noexcept {return chars_;}
2049 virtual operator base_type&() noexcept {return chars_;}
2050
2055 chars_ = str.chars_;
2056 return *this;
2057 }
2058
2063 chars_ = std::move(str.chars_);
2064 return *this;
2065 }
2066
2070 basic_string_builder& operator =(const std::basic_string<value_type>& str) noexcept {
2071 chars_ = str;
2072 return *this;
2073 }
2074
2078 basic_string_builder& operator =(std::basic_string<value_type>&& str) noexcept {
2079 chars_ = std::move(str);
2080 return *this;
2081 }
2082
2087 chars_ = str;
2088 return *this;
2089 }
2090
2095 chars_ = std::move(str);
2096 return *this;
2097 }
2098
2104 if (str == null) throw xtd::null_pointer_exception(csf_);
2105 chars_ = str;
2106 return *this;
2107 }
2108
2113 chars_ = character;
2114 return *this;
2115 }
2116
2120 basic_string_builder& operator =(const std::initializer_list<value_type>& il) {
2121 chars_ = il;
2122 return *this;
2123 }
2124
2129 chars_ += str.chars_;
2130 return *this;
2131 }
2132
2137 chars_ += std::move(str.chars_);
2138 str.chars_.clear();
2139 return *this;
2140 }
2141
2146 if (str == null) throw xtd::null_pointer_exception(csf_);
2147 chars_ += str;
2148 return *this;
2149 }
2150
2155 chars_ += ch;
2156 return *this;
2157 }
2158
2164 auto result = lhs;
2165 result += rhs;
2166 return result;
2167 }
2168
2174 auto result = std::move(lhs);
2175 result += std::move(rhs);
2176 return result;
2177 }
2178
2184 auto result = std::move(lhs);
2185 result += rhs;
2186 return result;
2187 }
2188
2194 auto result = lhs;
2195 result += std::move(rhs);
2196 return result;
2197 }
2198
2204 auto result = lhs;
2205 result += rhs;
2206 return result;
2207 }
2208
2214 auto result = std::move(lhs);
2215 result += rhs;
2216 return result;
2217 }
2218
2224 return lhs + rhs.chars_;
2225 }
2226
2232 return lhs + std::move(rhs).chars_;
2233 }
2234
2240 auto result = lhs;
2241 result += rhs;
2242 return result;
2243 }
2244
2250 auto result = std::move(lhs);
2251 result += rhs;
2252 return result;
2253 }
2254
2260 auto result = basic_string_builder(1, lhs);
2261 result += rhs;
2262 return result;
2263 }
2264
2270 auto result = basic_string_builder(1, lhs);
2271 result += std::move(rhs);
2272 return result;
2273 }
2274
2283 //friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string_builder& str) {return stream << str.to_string().chars_;}
2284 friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string_builder& str) {return stream << xtd::basic_string<char>(str.chars()).chars();}
2291 friend std::basic_ostream<xtd::wchar>& operator <<(std::basic_ostream<xtd::wchar>& stream, const basic_string_builder& str) {return stream << xtd::basic_string<xtd::wchar>(str.chars()).chars();}
2292
2301 friend std::basic_istream<char>& operator >>(std::basic_istream<char>& stream, basic_string_builder& str) {
2302 auto s = std::basic_string<char> {};
2303 stream >> s;
2305 return stream;
2306 }
2315 friend std::basic_istream<xtd::wchar>& operator >>(std::basic_istream<xtd::wchar>& stream, basic_string_builder& str) {
2316 auto s = std::basic_string<xtd::wchar> {};
2317 stream >> s;
2319 return stream;
2320 }
2322
2323 private:
2324 base_type chars_;
2325 size_type max_capacity_ = chars_.max_size();
2326 };
2327 }
2328}
The exception that is thrown when one of the arguments provided to a method is out of range.
Definition argument_out_of_range_exception.h:22
Represents text as a sequence of character units.
Definition basic_string.h:79
const base_type & chars() const noexcept
Returns a reference to the underlying base type.
Definition basic_string.h:783
size_type size() const noexcept
Returns the number of char_t elements in the string, i.e. std::distance(begin(), end()).
Definition basic_string.h:834
size_type length() const noexcept
Gets the number of characters in the current xtd::basic_string object.
Definition basic_string.h:818
static xtd::string new_line() noexcept
Gets the newline string defined for this environment.
static xtd::size combine(args_t... values) noexcept
Combines values into a hash code.
Definition hash_code.h:65
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.h:22
The exception that is thrown when an attempt is made to access an element of an array with an index t...
Definition index_out_of_range_exception.h:18
The exception that is thrown when there is an attempt to dereference a null object pointer.
Definition null_pointer_exception.h:18
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
Represents a mutable string of characters. This class cannot be inherited.
Definition basic_string_builder.h:35
size_type rfind(const_pointer s) const
Finds the last substring that is equal to the given character sequence. The search begins at xtd::tex...
Definition basic_string_builder.h:1957
typename base_type::size_type size_type
Represents the basic string size type.
Definition basic_string_builder.h:50
size_type find_first_of(const basic_string_builder &str, size_type pos) const
Finds the first character equal to one of the characters in the given character sequence....
Definition basic_string_builder.h:1244
basic_string_builder & append(object_t value)
Appends the string representation of a specified object to this instance.
Definition basic_string_builder.h:765
size_type find_first_of(value_type ch, size_type pos) const
Finds the first character equal to one of the characters in the given character sequence....
Definition basic_string_builder.h:1276
base_type & chars() noexcept
Returns a reference to the underlying base type.
Definition basic_string_builder.h:342
void push_back(value_type ch)
Appends the given character ch to the end of the string.
Definition basic_string_builder.h:1710
static constexpr size_type npos
This is a special value equal to the maximum value representable by the type xtd::size.
Definition basic_string_builder.h:77
basic_string_builder & operator+=(const basic_string_builder &str)
Addition assignment operator. Appends additional characters to the string.
Definition basic_string_builder.h:2128
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 ...
Definition basic_string_builder.h:154
typename base_type::difference_type difference_type
Represents the basic string difference type.
Definition basic_string_builder.h:52
size_type find_last_not_of(value_type ch) const
Finds the last character equal to none of the characters in the given character sequence....
Definition basic_string_builder.h:1402
iterator erase(const_iterator position)
Removes specified characters from the string.
Definition basic_string_builder.h:1182
bool equals(const basic_string_builder &value) const noexcept override
Determines whether this instance and another specified xtd::text::basic_string_builder object have th...
Definition basic_string_builder.h:1139
basic_string_builder & insert(size_type index, const_pointer s, size_type count)
Inserts characters into the string.
Definition basic_string_builder.h:1629
basic_string_builder & replace(size_type pos, size_type count, const basic_string_builder &str, size_type pos2)
Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count,...
Definition basic_string_builder.h:1799
size_type find_first_of(const_pointer s) const
Finds the first character equal to one of the characters in the given character sequence....
Definition basic_string_builder.h:1258
basic_string_builder & replace(const_iterator first, const_iterator last, input_iterator_t first2, input_iterator_t last2)
Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count,...
Definition basic_string_builder.h:1895
size_type find_first_of(const basic_string_builder &str) const
Finds the first character equal to one of the characters in the given character sequence....
Definition basic_string_builder.h:1238
basic_string_builder & insert(size_type index, xtd::uint16 value)
Inserts the string representation of a specified 16-bit unsigned integer into this instance at the sp...
Definition basic_string_builder.h:1542
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...
Definition basic_string_builder.h:275
basic_string_builder & append(const basic_string_builder &str, size_type pos)
Appends additional characters to the string.
Definition basic_string_builder.h:796
size_type find_last_of(const basic_string_builder &str) const
Finds the last character equal to one of characters in the given character sequence....
Definition basic_string_builder.h:1326
void resize(size_type count)
Resizes the string to contain count characters.
Definition basic_string_builder.h:1926
basic_string_builder substr() const
Returns a substring [pos, pos + count). If the requested substring extends past the end of the string...
Definition basic_string_builder.h:1986
size_type find_first_of(value_type ch) const
Finds the first character equal to one of the characters in the given character sequence....
Definition basic_string_builder.h:1270
basic_string_builder & insert(size_type index, double value)
Inserts the string representation of a specified double into this instance at the specified character...
Definition basic_string_builder.h:1482
int32 compare(const_pointer s) const
Compares two character sequences.
Definition basic_string_builder.h:1050
basic_string_builder & capacity(size_type value)
Sets the number of characters that the string has currently allocated space for.
Definition basic_string_builder.h:327
basic_string_builder & insert(size_type index, const basic_string_builder &str)
Inserts characters into the string.
Definition basic_string_builder.h:1636
size_type find(value_type ch) const
Finds the first substring equal to the given character sequence. Search begins at 0,...
Definition basic_string_builder.h:1226
friend std::basic_istream< char > & operator>>(std::basic_istream< char > &stream, basic_string_builder &str)
Input stream operator. Behaves as a FormattedInputFunction. After constructing and checking the sentr...
Definition basic_string_builder.h:2301
basic_string_builder & operator=(const basic_string_builder &str) noexcept
Copy assignment operator. Replaces the contents with a copy of the contents of str.
Definition basic_string_builder.h:2054
basic_string_builder & replace(size_type pos, size_type count, const_pointer cstr, size_type count2)
Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count,...
Definition basic_string_builder.h:1826
basic_string_builder & append(const_pointer s, size_type count)
Appends additional characters to the string.
Definition basic_string_builder.h:825
size_type capacity() const noexcept
Returns the number of characters that the string has currently allocated space for.
Definition basic_string_builder.h:324
basic_string_builder & append(const basic_string_builder &str, size_type pos, size_type count)
Appends additional characters to the string.
Definition basic_string_builder.h:809
basic_string_builder & replace(value_type old_char, value_type new_char) noexcept
Replaces all occurrences of a specified character in this instance with another specified character.
Definition basic_string_builder.h:1726
basic_string_builder & append(xtd::int16 value)
Appends the string representation of a specified 16-bit signed integer value to this instance.
Definition basic_string_builder.h:589
typename base_type::traits_type traits_type
Represents the basic string traits type.
Definition basic_string_builder.h:44
size_type find_first_not_of(value_type ch, size_type pos) const
Finds the first character equal to none of the characters in the given character sequence....
Definition basic_string_builder.h:1320
virtual const base_type & get_base_type() const noexcept
Returns the underlying base type.
Definition basic_string_builder.h:1416
basic_string_builder & length(size_type value) noexcept
Sets or sets the length of the current xtd::text::basic_string_builder object.
Definition basic_string_builder.h:402
basic_string_builder & replace(size_type pos, size_type count, const basic_string_builder &str)
Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count,...
Definition basic_string_builder.h:1776
size_type rfind(value_type ch) const
Finds the last substring that is equal to the given character sequence. The search begins at xtd::tex...
Definition basic_string_builder.h:1969
basic_string_builder & append(double value)
Appends the string representation of a specified double value to this instance.
Definition basic_string_builder.h:551
iterator end()
Returns an iterator to the character following the last character of the string. This character acts ...
Definition basic_string_builder.h:374
basic_string_builder(xtd::size capacity)
Initializes a new instance of the xtd::text::basic_string_builder class using the specified capacity.
Definition basic_string_builder.h:101
size_type find_first_not_of(value_type ch) const
Finds the first character equal to none of the characters in the given character sequence....
Definition basic_string_builder.h:1314
basic_string_builder & replace(const_iterator first, const_iterator last, const_pointer cstr)
Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count,...
Definition basic_string_builder.h:1860
basic_string_builder & append_line(const xtd::basic_string< char_t > &value)
Appends a copy of the specified string followed by the default line terminator to the end of the curr...
Definition basic_string_builder.h:922
basic_string_builder & insert(size_type index, const basic_string_builder &str, size_type s_index)
Inserts characters into the string.
Definition basic_string_builder.h:1659
size_type find_last_not_of(const_pointer s) const
Finds the last character equal to none of the characters in the given character sequence....
Definition basic_string_builder.h:1390
basic_string_builder & replace(size_type pos, size_type count, const basic_string_builder &str, size_type pos2, size_type count2)
Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count,...
Definition basic_string_builder.h:1813
size_type find(const_pointer s, size_type pos) const
Finds the first substring equal to the given character sequence. Search begins at pos,...
Definition basic_string_builder.h:1221
basic_string_builder & append(xtd::int32 value)
Appends the string representation of a specified 32-bit signed integer value to this instance.
Definition basic_string_builder.h:608
size_type find_last_of(value_type ch) const
Finds the last character equal to one of characters in the given character sequence....
Definition basic_string_builder.h:1358
basic_string_builder & insert(size_type index, xtd::decimal value)
Inserts the string representation of a specified 8decimal into this instance at the specified charact...
Definition basic_string_builder.h:1472
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 ...
Definition basic_string_builder.h:116
const_reference operator[](xtd::size index) const
Returns a reference to the character at specified location index.
Definition basic_string_builder.h:2031
basic_string_builder & append(xtd::sbyte value)
Appends the string representation of a specified 8-bit signed integer value to this instance.
Definition basic_string_builder.h:647
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 alloc...
Definition basic_string_builder.h:269
void shrink_to_fit()
Requests the removal of unused capacity.
Definition basic_string_builder.h:1980
basic_string_builder substr(size_type pos, size_type count) const
Returns a substring [pos, pos + count). If the requested substring extends past the end of the string...
Definition basic_string_builder.h:2002
iterator erase(const_iterator first, const_iterator last)
Removes specified characters from the string.
Definition basic_string_builder.h:1189
size_type find_last_of(const_pointer s) const
Finds the last character equal to one of characters in the given character sequence....
Definition basic_string_builder.h:1346
const_reference at(size_type pos) const
Returns a reference to the character at specified location pos.
Definition basic_string_builder.h:927
basic_string_builder & insert(size_type index, value_type value, size_type repeat_count)
Inserts a specified number of copies of the string representation of a Unicode character to this inst...
Definition basic_string_builder.h:1583
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.
Definition basic_string_builder.h:125
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,...
Definition basic_string_builder.h:201
size_type find_last_not_of(value_type ch, size_type pos) const
Finds the last character equal to none of the characters in the given character sequence....
Definition basic_string_builder.h:1408
basic_string_builder & insert(size_type index, size_type count, value_type ch)
Inserts characters into the string.
Definition basic_string_builder.h:1609
basic_string_builder & append(const xtd::basic_string< char_t > &value, size_type start_index, size_type count)
Appends a copy of a specified substring to this instance.
Definition basic_string_builder.h:474
size_type rfind(const basic_string_builder &str, size_type pos) const
Finds the last substring that is equal to the given character sequence. The search begins at pos and ...
Definition basic_string_builder.h:1943
basic_string_builder & append(value_type value, size_type repeat_count)
Appends a specified number of copies of the string representation of a Unicode character to this inst...
Definition basic_string_builder.h:747
basic_string_builder & append(value_type value)
Appends the string representation of a specified xtd::text::basic_string_builder::value_type value to...
Definition basic_string_builder.h:727
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.
Definition basic_string_builder.h:265
size_type find_first_of(const_pointer s, size_type pos) const
Finds the first character equal to one of the characters in the given character sequence....
Definition basic_string_builder.h:1265
iterator insert(const_iterator pos, std::initializer_list< value_type > ilist)
Inserts characters into the string.
Definition basic_string_builder.h:1699
basic_string_builder & append(const basic_string_builder &str)
Appends additional characters to the string.
Definition basic_string_builder.h:784
size_type find_first_not_of(const_pointer s) const
Finds the first character equal to none of the characters in the given character sequence....
Definition basic_string_builder.h:1302
size_type find_first_not_of(const_pointer s, size_type pos) const
Finds the first character equal to none of the characters in the given character sequence....
Definition basic_string_builder.h:1309
size_type find_last_not_of(const basic_string_builder &str) const
Finds the last character equal to none of the characters in the given character sequence....
Definition basic_string_builder.h:1370
basic_string_builder & erase()
Removes specified characters from the string.
Definition basic_string_builder.h:1154
typename base_type::const_pointer const_pointer
Represents the basic string const pointer type.
Definition basic_string_builder.h:60
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 characte...
Definition basic_string_builder.h:232
size_type find_first_of(const_pointer s, size_type pos, size_type count) const
Finds the first character equal to one of the characters in the given character sequence....
Definition basic_string_builder.h:1252
size_type find_last_of(const_pointer s, size_type pos) const
Finds the last character equal to one of characters in the given character sequence....
Definition basic_string_builder.h:1353
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 alloc...
Definition basic_string_builder.h:212
basic_string_builder & append(input_iterator_t first, input_iterator_t last)
Appends additional characters to the string.
Definition basic_string_builder.h:844
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,...
Definition basic_string_builder.h:258
xtd::size get_hash_code() const noexcept override
Returns the hash code for this basic_string_builder.
Definition basic_string_builder.h:1420
size_type find_first_not_of(const basic_string_builder &str, size_type pos) const
Finds the first character equal to none of the characters in the given character sequence....
Definition basic_string_builder.h:1288
basic_string_builder & append(xtd::decimal value)
Appends the string representation of a specified decimal value to this instance.
Definition basic_string_builder.h:532
basic_string_builder & insert(size_type index, const basic_string_builder &str, size_type s_index, size_type count)
Inserts characters into the string.
Definition basic_string_builder.h:1645
basic_string_builder & replace(value_type old_char, value_type new_char, size_type start_index, size_type count)
Replaces, within a substring of this instance, all occurrences of a specified character with another ...
Definition basic_string_builder.h:1734
size_type copy(pointer dest, size_type count, size_type pos) const
Copies a substring [pos, pos + count) to character string pointed to by dest. If the requested substr...
Definition basic_string_builder.h:1112
size_type find_last_of(const basic_string_builder &str, size_type pos) const
Finds the last character equal to one of characters in the given character sequence....
Definition basic_string_builder.h:1332
size_type length() const noexcept
Gets or sets the length of the current xtd::text::basic_string_builder object.
Definition basic_string_builder.h:392
reference front()
Returns reference to the first character in the string. The behavior is undefined if empty() is true.
Definition basic_string_builder.h:383
basic_string_builder & append(xtd::uint64 value)
Appends the string representation of a specified 64-bit unsigned integer value to this instance.
Definition basic_string_builder.h:704
basic_string_builder()=default
Initializes a new instance of xtd::text::basic_string_builder.
basic_string_builder & append(xtd::uint32 value)
Appends the string representation of a specified 32-bit unsigned integer value to this instance.
Definition basic_string_builder.h:685
reference at(size_type pos)
Returns a reference to the character at specified location pos.
Definition basic_string_builder.h:931
basic_string_builder & insert(size_type index, xtd::boolean value)
Inserts the string representation of a boolean value into this instance at the specified character po...
Definition basic_string_builder.h:1452
basic_string_builder & append(const xtd::basic_string< char_t > &value)
Appends a copy of the specified string to this instance.
Definition basic_string_builder.h:442
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 a...
Definition basic_string_builder.h:181
iterator insert(const_iterator pos, size_type count, value_type ch)
Inserts characters into the string.
Definition basic_string_builder.h:1674
size_type find_first_not_of(const basic_string_builder &str) const
Finds the first character equal to none of the characters in the given character sequence....
Definition basic_string_builder.h:1282
typename base_type::const_reference const_reference
Represents the basic string const referecne type.
Definition basic_string_builder.h:56
basic_string_builder & insert(size_type index, value_type value)
Inserts the string representation of a specified Unicode character into this instance at the specifie...
Definition basic_string_builder.h:1572
basic_string_builder & replace(const_iterator first, const_iterator last, const basic_string_builder &str)
Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count,...
Definition basic_string_builder.h:1788
iterator insert(const_iterator pos, input_iterator_t first, input_iterator_t last)
Inserts characters into the string.
Definition basic_string_builder.h:1688
basic_string_builder & append(std::initializer_list< value_type > ilist)
Appends additional characters to the string.
Definition basic_string_builder.h:856
size_type find_last_not_of(const basic_string_builder &str, size_type pos) const
Finds the last character equal to none of the characters in the given character sequence....
Definition basic_string_builder.h:1376
int32 compare(size_type pos1, size_type count1, const_pointer s) const
Compares two character sequences.
Definition basic_string_builder.h:1072
basic_string_builder & append(const_pointer s)
Appends additional characters to the string.
Definition basic_string_builder.h:834
basic_string_builder & append(xtd::byte value)
Appends the string representation of a specified 8-bit unsigned value to this instance.
Definition basic_string_builder.h:513
basic_string_builder & append_join(value_type separator, const collection_t &values)
Concatenates and appends the members of a collection, using the specified xtd::basic_string_builder::...
Definition basic_string_builder.h:899
basic_string_builder & insert(size_type index, xtd::uint64 value)
Inserts the string representation of a specified 64-bit unsigned integer into this instance at the sp...
Definition basic_string_builder.h:1562
size_type max_capacity() const noexcept
Returns the number of characters that the string has currently allocated space for.
Definition basic_string_builder.h:409
size_type find(const_pointer s, size_type pos, size_type count) const
Finds the first substring equal to the given character sequence. Search begins at pos,...
Definition basic_string_builder.h:1208
xtd::string to_string() const noexcept override
Converts the value of this instance to a xtd::text::basic_string_builder <char>.
Definition basic_string_builder.h:2015
friend std::basic_ostream< char > & operator<<(std::basic_ostream< char > &stream, const basic_string_builder &str)
Output stream operator. Behaves as a FormattedOutputFunction. After constructing and checking the sen...
Definition basic_string_builder.h:2284
basic_string_builder & clear()
Removes all characters from the current xtd::text::basic_string_builder instance.
Definition basic_string_builder.h:937
basic_string_builder & replace(const xtd::basic_string< char_t > &old_value, const xtd::basic_string< char_t > &new_value) noexcept
Replaces all occurrences of a specified string in this instance with another specified string.
Definition basic_string_builder.h:1741
basic_string_builder & replace(const_iterator first, const_iterator last, std::initializer_list< value_type > ilist)
Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count,...
Definition basic_string_builder.h:1906
basic_string_builder & append(xtd::int64 value)
Appends the string representation of a specified 64-bit signed integer value to this instance.
Definition basic_string_builder.h:627
const_pointer c_str() const noexcept
Returns a pointer to a null-terminated character array with data equivalent to those stored in the st...
Definition basic_string_builder.h:320
const_reference back() const
Returns reference to the last character in the string.
Definition basic_string_builder.h:299
basic_string_builder & insert(size_type index, object_t value)
Inserts the string representation of a specified object into this instance at the specified character...
Definition basic_string_builder.h:1601
basic_string_builder & insert(size_type index, xtd::int32 value)
Inserts the string representation of a specified 32-bit signed integer into this instance at the spec...
Definition basic_string_builder.h:1512
int32 compare(size_type pos1, size_type count1, const basic_string_builder &str, size_type pos2) const
Compares two character sequences.
Definition basic_string_builder.h:1006
typename base_type::reference reference
Represents the basic string referecne type.
Definition basic_string_builder.h:54
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 an...
Definition basic_string_builder.h:137
basic_string_builder & replace(size_type pos, size_type count, size_type count2, value_type ch)
Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count,...
Definition basic_string_builder.h:1870
size_type rfind(const_pointer s, size_type pos, size_type count) const
Finds the last substring that is equal to the given character sequence. The search begins at pos and ...
Definition basic_string_builder.h:1951
int32 compare(size_type pos1, size_type count1, const_pointer s, size_type count2) const
Compares two character sequences.
Definition basic_string_builder.h:1095
size_type max_size() const noexcept
Returns the maximum number of elements the string is able to hold due to system or library implementa...
Definition basic_string_builder.h:413
size_type find_last_not_of(const_pointer s, size_type pos) const
Finds the last character equal to none of the characters in the given character sequence....
Definition basic_string_builder.h:1397
basic_string_builder(basic_string_builder &&str) noexcept
Initializes a new instance of xtd::text::basic_string_builder with specified string to move.
Definition basic_string_builder.h:208
void swap(basic_string_builder &other) noexcept
Exchanges the contents of the string with those of other. All iterators and references may be invalid...
Definition basic_string_builder.h:2009
size_type find(const_pointer s) const
Finds the first substring equal to the given character sequence. Search begins at 0,...
Definition basic_string_builder.h:1214
const_iterator cbegin() const
Returns an iterator to the first character of the string.
Definition basic_string_builder.h:334
basic_string_builder(xtd::size count, value_type character)
Definition basic_string_builder.h:217
typename base_type::pointer pointer
Represents the basic string pointer type.
Definition basic_string_builder.h:58
basic_string_builder substr(size_type pos) const
Returns a substring [pos, pos + count). If the requested substring extends past the end of the string...
Definition basic_string_builder.h:1992
basic_string_builder & erase(size_type index)
Removes specified characters from the string.
Definition basic_string_builder.h:1162
basic_string_builder & replace(const_iterator first, const_iterator last, const_pointer cstr, size_type count2)
Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count,...
Definition basic_string_builder.h:1840
basic_string_builder & append_join(const xtd::basic_string< char_t > &separator, const collection_t &values)
Concatenates and appends the members of a collection, using the specified separator between each memb...
Definition basic_string_builder.h:889
basic_string_builder & remove(size_type start_index, size_type length)
Removes the specified range of characters from this instance.
Definition basic_string_builder.h:1719
typename base_type::iterator iterator
Represents the basic string iterator type.
Definition basic_string_builder.h:63
void reserve(size_type new_cap)
Informs a xtd::text::basic_string_builder object of a planned change in size, so that it can manage t...
Definition basic_string_builder.h:1916
iterator insert(const_iterator pos, value_type ch)
Inserts characters into the string.
Definition basic_string_builder.h:1666
size_type rfind(const_pointer s, size_type pos) const
Finds the last substring that is equal to the given character sequence. The search begins at pos and ...
Definition basic_string_builder.h:1964
const_iterator begin() const
Returns an iterator to the first character of the string.
Definition basic_string_builder.h:307
void copy_to(xtd::size source_index, xtd::array< value_type > &destination, xtd::size destination_index, xtd::size destination_count) const
Copies the characters from a specified segment of this instance to a specified segment of a destinati...
Definition basic_string_builder.h:1125
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 c...
Definition basic_string_builder.h:191
basic_string_builder(const_pointer str, xtd::size count)
Initializes a new instance of xtd::text::basic_string_builder with specified substring and count char...
Definition basic_string_builder.h:250
void resize(size_type count, value_type ch)
Resizes the string to contain count characters.
Definition basic_string_builder.h:1932
basic_string_builder(const basic_string_builder &str) noexcept
Initializes a new instance of xtd::text::basic_string_builder with specified string to copy.
Definition basic_string_builder.h:162
void pop_back()
Removes the last character from the string.
Definition basic_string_builder.h:1706
allocator_type get_allocator() const
Returns the allocator associated with the string.
Definition basic_string_builder.h:1412
basic_string_builder & insert(size_type index, xtd::byte value)
Inserts the string representation of a specified 8-bit unsigned integer into this instance at the spe...
Definition basic_string_builder.h:1462
basic_string_builder(const_pointer str)
Initializes a new instance of xtd::text::basic_string_builder with specified string to copy.
Definition basic_string_builder.h:236
basic_string_builder(const allocator_type &allocator) noexcept
Initializes a new instance of xtd::text::basic_string_builder with specified allocator.
Definition basic_string_builder.h:158
basic_string_builder & erase(size_type index, size_type count)
Removes specified characters from the string.
Definition basic_string_builder.h:1172
basic_string_builder & replace(size_type pos, size_type count, const_pointer cstr)
Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count,...
Definition basic_string_builder.h:1850
size_type ensure_capacity(size_type capacity)
Ensures that the capacity of this instance of xtd::text::basic_string_builder is at least the specifi...
Definition basic_string_builder.h:1146
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...
Definition basic_string_builder.h:281
basic_string_builder & insert(size_type index, xtd::sbyte value)
Inserts the string representation of a specified 8-bit signed integer into this instance at the speci...
Definition basic_string_builder.h:1532
basic_string_builder(std::initializer_list< value_type > il)
Initializes a new instance of xtd::text::basic_string_builder with specified initializer list.
Definition basic_string_builder.h:285
const base_type & chars() const noexcept
Returns a reference to the underlying base type.
Definition basic_string_builder.h:338
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.
Definition basic_string_builder.h:172
const_reference front() const
Returns reference to the first character in the string. The behavior is undefined if empty() is true.
Definition basic_string_builder.h:379
int32 compare(size_type pos1, size_type count1, const basic_string_builder &str) const
Compares two character sequences.
Definition basic_string_builder.h:982
bool empty() const noexcept
Checks if the string has no characters, i.e. whether begin() == end().
Definition basic_string_builder.h:367
basic_string_builder & insert(size_type index, const xtd::basic_string< char_t > &value, size_type count)
Inserts one or more copies of a specified string into this instance at the specified character positi...
Definition basic_string_builder.h:1442
std::basic_string< char_t, traits_t, allocator_t > base_type
Represents the basic string base type.
Definition basic_string_builder.h:42
size_type find(const basic_string_builder &str, size_type pos) const
Finds the first substring equal to the given character sequence. Search begins at pos,...
Definition basic_string_builder.h:1200
iterator begin()
Returns an iterator to the first character of the string.
Definition basic_string_builder.h:310
size_type find_first_not_of(const_pointer s, size_type pos, size_type count) const
Finds the first character equal to none of the characters in the given character sequence....
Definition basic_string_builder.h:1296
size_type find(value_type ch, size_type pos) const
Finds the first substring equal to the given character sequence. Search begins at pos,...
Definition basic_string_builder.h:1232
size_type size() const noexcept
Returns the number of char_t elements in the string, i.e. std::distance(begin(), end()).
Definition basic_string_builder.h:417
const_pointer data() const noexcept
Returns a pointer to the underlying array serving as character storage. The pointer is such that the ...
Definition basic_string_builder.h:355
pointer data() noexcept
Returns a pointer to the underlying array serving as character storage. The pointer is such that the ...
Definition basic_string_builder.h:363
basic_string_builder & replace(const xtd::basic_string< char_t > &old_value, const xtd::basic_string< char_t > &new_value, size_type start_index, size_type count)
Replaces, within a substring of this instance, all occurrences of a specified string with another spe...
Definition basic_string_builder.h:1750
friend basic_string_builder operator+(const basic_string_builder &lhs, const basic_string_builder &rhs)
Addition operator. Returns a string containing characters from lhs followed by the characters from rh...
Definition basic_string_builder.h:2163
basic_string_builder & insert(size_type index, const xtd::basic_string< char_t > &value)
Inserts a string into this instance at the specified character position.
Definition basic_string_builder.h:1431
basic_string_builder & append_line()
Appends the default line terminator to the end of the current xtd::text::basic_string_builder object.
Definition basic_string_builder.h:914
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 all...
Definition basic_string_builder.h:290
int32 compare(const basic_string_builder &str) const
Compares two character sequences.
Definition basic_string_builder.h:960
size_type rfind(value_type ch, size_type pos) const
Finds the last substring that is equal to the given character sequence. The search begins at pos and ...
Definition basic_string_builder.h:1975
size_type find_last_not_of(const_pointer s, size_type pos, size_type count) const
Finds the last character equal to none of the characters in the given character sequence....
Definition basic_string_builder.h:1384
size_type find(const basic_string_builder &str) const
Finds the first substring equal to the given character sequence. Search begins at 0,...
Definition basic_string_builder.h:1194
typename base_type::const_reverse_iterator const_reverse_iterator
Represents the basic string const reverse iterator type.
Definition basic_string_builder.h:70
size_type copy(pointer dest, size_type count) const
Copies a substring [pos, pos + count) to character string pointed to by dest. If the requested substr...
Definition basic_string_builder.h:1102
basic_string_builder & insert(size_type index, const_pointer s)
Inserts characters into the string.
Definition basic_string_builder.h:1621
typename base_type::const_iterator const_iterator
Represents the basic string const iterator type.
Definition basic_string_builder.h:66
basic_string_builder & append(xtd::single value)
Appends the string representation of a specified single value to this instance.
Definition basic_string_builder.h:570
basic_string_builder & insert(size_type index, xtd::uint32 value)
Inserts the string representation of a specified 32-bit unsigned integer into this instance at the sp...
Definition basic_string_builder.h:1552
basic_string_builder & replace(const_iterator first, const_iterator last, size_type count2, value_type ch)
Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count,...
Definition basic_string_builder.h:1882
basic_string_builder & append(xtd::uint16 value)
Appends the string representation of a specified 16-bit unsigned integer value to this instance.
Definition basic_string_builder.h:666
basic_string_builder & insert(size_type index, xtd::int64 value)
Inserts the string representation of a specified 64-bit signed integer into this instance at the spec...
Definition basic_string_builder.h:1522
reference back()
Returns reference to the last character in the string.
Definition basic_string_builder.h:303
typename base_type::allocator_type allocator_type
Represents the basic string allocator type.
Definition basic_string_builder.h:48
basic_string_builder & insert(size_type index, xtd::int16 value)
Inserts the string representation of a specified 16-bit signed integer into this instance at the spec...
Definition basic_string_builder.h:1502
const_iterator cend() const
Returns an iterator to the character following the last character of the string. This character acts ...
Definition basic_string_builder.h:346
typename base_type::reverse_iterator reverse_iterator
Represents the basic string reverse iterator type.
Definition basic_string_builder.h:68
const_iterator end() const
Returns an iterator to the character following the last character of the string. This character acts ...
Definition basic_string_builder.h:371
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,...
Definition basic_string_builder.h:243
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 alloc...
Definition basic_string_builder.h:166
basic_string_builder & insert(size_type index, xtd::single value)
Inserts the string representation of a specified single into this instance at the specified character...
Definition basic_string_builder.h:1492
size_type find_last_of(const_pointer s, size_type pos, size_type count) const
Finds the last character equal to one of characters in the given character sequence....
Definition basic_string_builder.h:1340
basic_string_builder(value_type character, xtd::size count)
Initializes a new instance of xtd::text::basic_string_builder with specified count copies of characte...
Definition basic_string_builder.h:227
size_type find_last_of(value_type ch, size_type pos) const
Finds the last character equal to one of characters in the given character sequence....
Definition basic_string_builder.h:1364
bool equals(const object &obj) const noexcept override
Determines whether this instance and a specified object, which must also be a xtd::text::basic_string...
Definition basic_string_builder.h:1134
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 characte...
Definition basic_string_builder.h:222
int32 compare(size_type pos1, size_type count1, const basic_string_builder &str, size_type pos2, size_type count2) const
Compares two character sequences.
Definition basic_string_builder.h:1031
typename base_type::value_type value_type
Represents the basic string value type.
Definition basic_string_builder.h:46
basic_string_builder & append(xtd::boolean value)
Appends the string representation of a specified boolean value to this instance.
Definition basic_string_builder.h:493
size_type rfind(const basic_string_builder &str) const
Finds the last substring that is equal to the given character sequence. The search begins at xtd::tex...
Definition basic_string_builder.h:1937
basic_string_builder & append_format(const xtd::basic_string< char_t > &format, args_t &&... args)
Appends the string returned by processing a composite format string, which contains zero or more form...
Definition basic_string_builder.h:878
basic_string_builder & append(size_type count, value_type ch)
Appends additional characters to the string.
Definition basic_string_builder.h:775
#define csf_
Provides information about the current stack frame.
Definition current_stack_frame.h:30
int16_t int16
Represents a 16-bit signed integer.
Definition int16.h:23
int32_t int32
Represents a 32-bit signed integer.
Definition int32.h:23
long double decimal
Represents a decimal-precision floating-point number.
Definition decimal.h:23
int64_t int64
Represents a 64-bit signed integer.
Definition int64.h:23
__ulong__ ulong
Represents a 32-bit or 64-bit unsigned integer.
Definition ulong.h:27
int8_t sbyte
Represents a 8-bit signed integer.
Definition sbyte.h:23
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.h:23
float single
Represents a single-precision floating-point number.
Definition single.h:23
std::nullptr_t null
Represents a null pointer value.
size_t size
Represents a size of any object in bytes.
Definition size.h:23
uint64_t uint64
Represents a 64-bit unsigned integer.
Definition uint64.h:23
bool boolean
Represents a boolean.
Definition boolean.h:23
uint8_t byte
Represents a 8-bit unsigned integer.
Definition byte.h:23
uint16_t uint16
Represents a 16-bit unsigned integer.
Definition uint16.h:23
__slong__ slong
Represents a 32-bit or 64-bit signed integer.
Definition slong.h:27
@ other
The operating system is other.
@ s
The S key.
@ separator
The Separator key.
@ insert
The INS (INSERT) key.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
std::vector< type_t > array
Definition __array_definition.h:18