xtd 1.0.0
Loading...
Searching...
No Matches
basic_string_builder.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../basic_string.hpp"
6#include "../environment.hpp"
8#include <iterator>
11namespace xtd {
13 namespace text {
31 template<typename char_t, typename traits_t = std::char_traits<char_t>, typename allocator_t = xtd::collections::generic::helpers::allocator<char_t >>
32 class basic_string_builder final : public object, public xtd::iequatable<basic_string_builder<char_t, traits_t, allocator_t>> {
33 public:
35
39 using base_type = std::basic_string<char_t, traits_t, allocator_t>;
41 using traits_type = typename base_type::traits_type;
43 using value_type = typename base_type::value_type;
45 using allocator_type = typename base_type::allocator_type;
47 using size_type = typename base_type::size_type;
49 using difference_type = typename base_type::difference_type;
51 using reference = typename base_type::reference;
53 using const_reference = typename base_type::const_reference;
55 using pointer = typename base_type::pointer;
57 using const_pointer = typename base_type::const_pointer;
60 using iterator = typename base_type::iterator;
63 using const_iterator = typename base_type::const_iterator;
65 using reverse_iterator = typename base_type::reverse_iterator;
67 using const_reverse_iterator = typename base_type::const_reverse_iterator;
69
71
81 inline static constexpr size_type npos = base_type::npos;
82
91 static inline constexpr xtd::usize bpos = 0;
92
109 static inline constexpr xtd::usize epos = npos - 1;
111
113
186 basic_string_builder(const xtd::basic_string<value_type>& value, xtd::usize start_index, xtd::usize length, xtd::usize capacity) : chars_(value.substring(start_index, length).chars()) {self_.capacity(capacity);}
187
190 explicit basic_string_builder(const allocator_type & allocator) noexcept : chars_(allocator) {}
191
194 basic_string_builder(const basic_string_builder & str) noexcept : chars_(str.chars_) {}
198 basic_string_builder(const basic_string_builder & str, const allocator_type & allocator) noexcept : chars_(str.chars_, allocator) {}
199
208
215 chars_ = base_type(str.chars_, index, allocator);
216 }
217
225 chars_ = base_type(str.chars_, index, count);
226 }
227
233 basic_string_builder(const basic_string_builder & str, xtd::usize index, xtd::usize count, const allocator_type & allocator) {
235 chars_ = base_type(str.chars_, index, count, allocator);
236 }
237
240 basic_string_builder(basic_string_builder&& str) noexcept : chars_(std::move(str.chars_)) {}
244 basic_string_builder(basic_string_builder&& str, const allocator_type & allocator) noexcept : chars_(std::move(str.chars_), allocator) {}
245
254 basic_string_builder(xtd::usize count, value_type character, const allocator_type & allocator) : chars_(count, character, allocator) {}
255
264 basic_string_builder(value_type character, xtd::usize count, const allocator_type & allocator) : chars_(count, character, allocator) {}
265
268 basic_string_builder(const_pointer str) { // Can't be explicit by design.
270 chars_ = base_type(str);
271 }
272
279
286
290 basic_string_builder(const_pointer str, xtd::usize count, const allocator_type & allocator) : chars_(allocator) {
292 chars_ = base_type(str, count);
293 }
294
297 basic_string_builder(const std::basic_string<value_type>& str) noexcept : chars_(str) {}; // Can't be explicit by design.
301 basic_string_builder(const std::basic_string<value_type>& str, const allocator_type & allocator) noexcept : chars_(str, allocator) {}
302
306 template<typename input_iterator_t>
307 basic_string_builder(input_iterator_t first, input_iterator_t last) : chars_(first, last) {}
312 template<typename input_iterator_t>
313 basic_string_builder(input_iterator_t first, input_iterator_t last, const allocator_type & allocator) : chars_(first, last, allocator) {}
314
317 basic_string_builder(std::initializer_list<value_type> il) : chars_(il) {}
318
322 basic_string_builder(std::initializer_list<value_type> il, const allocator_type & allocator) : chars_(il, allocator) {}
324
326
330 [[nodiscard]] auto begin() const -> const_iterator {return chars_.begin();}
333 [[nodiscard]] auto begin() -> iterator {return chars_.begin();}
334
343 [[nodiscard]] auto c_str() const noexcept -> const_pointer {return chars_.c_str();}
344
347 [[nodiscard]] auto capacity() const noexcept -> size_type {return chars_.capacity();}
352 chars_.reserve(value);
353 return self_;
354 }
355
358 [[nodiscard]] auto cbegin() const -> const_iterator {return chars_.cbegin();}
359
362 [[nodiscard]] auto chars() const noexcept -> const base_type& {return chars_;}
363
366 [[nodiscard]] auto chars() noexcept -> base_type& {return chars_;}
367
370 [[nodiscard]] auto cend() const -> const_iterator {return chars_.cend();}
371
379 [[nodiscard]] auto data() const noexcept -> const_pointer {return chars_.data();}
387 [[nodiscard]] auto data() noexcept -> pointer {return chars_.data();}
388
391 [[nodiscard]] auto empty() const noexcept -> bool {return chars_.empty();}
392
395 [[nodiscard]] auto end() const -> const_iterator {return chars_.end();}
398 [[nodiscard]] auto end() -> iterator {return chars_.end();}
399
407 [[nodiscard]] auto length() const noexcept -> size_type {return chars_.size();}
417 auto length(size_type value) noexcept -> basic_string_builder& {
418 if (value != length()) chars_.resize(value);
419 return self_;
420 }
421
424 [[nodiscard]] auto max_capacity() const noexcept -> size_type {return max_capacity_;}
425
428 [[nodiscard]] auto size() const noexcept -> size_type {return length();}
430
432
485 auto append(const xtd::basic_string<char_t>& value, size_type start_index, size_type count) -> basic_string_builder& {return append(basic_string_builder {value, start_index, count});}
504 auto append(xtd::boolean value) -> basic_string_builder& {return append_format("{}", value);}
524 auto append(xtd::byte value) -> basic_string_builder& {return append_format("{}", value);}
543 auto append(xtd::decimal value) -> basic_string_builder& {return append_format("{}", value);}
562 auto append(double value) -> basic_string_builder& {return append_format("{}", value);}
581 auto append(xtd::single value) -> basic_string_builder& {return append_format("{}", value);}
600 auto append(xtd::int16 value) -> basic_string_builder& {return append_format("{}", value);}
619 auto append(xtd::int32 value) -> basic_string_builder& {return append_format("{}", value);}
638 auto append(xtd::int64 value) -> basic_string_builder& {return append_format("{}", value);}
658 auto append(xtd::sbyte value) -> basic_string_builder& {return append_format("{}", value);}
677 auto append(xtd::uint16 value) -> basic_string_builder& {return append_format("{}", value);}
696 auto append(xtd::uint32 value) -> basic_string_builder& {return append_format("{}", value);}
715 auto append(xtd::uint64 value) -> basic_string_builder& {return append_format("{}", value);}
738 auto append(value_type value) -> basic_string_builder& {return append(1_z, value);}
758 auto append(value_type value, size_type repeat_count) -> basic_string_builder& {return append(repeat_count, value);}
759
761 auto append(xtd::slong value) -> basic_string_builder& {return append_format("{}", value);}
762 auto append(xtd::ulong value) -> basic_string_builder& {return append_format("{}", value);}
764
775 template<typename object_t>
776 auto append(object_t value) -> basic_string_builder& {return append_format("{}", value);}
795 auto append(const basic_string_builder & str) -> basic_string_builder& {return append(str, 0, str.length());}
807 auto append(const basic_string_builder & str, size_type pos) -> basic_string_builder& {return append(str, pos, str.length() - pos);}
822 if (pos > str.length() || pos + count > str.length()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range);
823 chars_.append(str.chars_, pos, count);
824 return self_;
825 }
826
854 template<typename input_iterator_t>
859
867 auto append(std::initializer_list<value_type> ilist) -> basic_string_builder& {return append(basic_string_builder {ilist});}
868
888 template<typename ...args_t>
889 auto append_format(const xtd::basic_string<char_t>& format, args_t&& ... args) -> basic_string_builder& {return append(xtd::basic_string<char_t>::format(format, std::forward<args_t>(args)...));}
890
899 template<typename collection_t>
909 template<typename collection_t>
911
913 template<typename value_t>
914 auto append_join(const xtd::basic_string<char_t>& separator, const std::initializer_list<value_t>& values) -> basic_string_builder& {return append_join(separator, xtd::array<value_t>(values));}
915 template<typename value_t>
916 auto append_join(value_type separator, const std::initializer_list<value_t>& values) -> basic_string_builder& {return append_join(separator, xtd::array<value_t>(values));}
918
933 auto append_line(const xtd::basic_string<char_t>& value) -> basic_string_builder& {return append(value).append_line();}
934
940 chars_.clear();
941 return self_;
942 }
943
952 auto copy_to(xtd::usize source_index, xtd::array<value_type>& destination, xtd::usize destination_index, xtd::usize destination_count) const -> void {
953 if (source_index > length() || source_index + destination_count > length()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range);
954 if (destination_index >= destination.length() || destination_index + destination_count > destination.length()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range);
955 chars_.copy(destination.data() + destination_index, destination_count, source_index);
956 }
957
961 [[nodiscard]] auto equals(const object & obj) const noexcept -> bool override {return dynamic_cast<const basic_string_builder*>(&obj) && equals(static_cast<const basic_string_builder&>(obj));}
966 [[nodiscard]] auto equals(const basic_string_builder & value) const noexcept -> bool override {return chars_ == value.chars_;}
967
974 if (self_.capacity() < capacity) self_.capacity(capacity);
975 return self_.capacity();
976 }
977
980 [[nodiscard]] auto get_base_type() const noexcept -> const base_type& {return chars_;}
981
984 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override {return xtd::hash_code::combine(chars_);}
985
995 auto insert(size_type index, const xtd::basic_string<char_t>& value) -> basic_string_builder& {return insert(index, basic_string_builder {value}, 0, value.length());}
1006 auto insert(size_type index, const xtd::basic_string<char_t>& value, size_type count) -> basic_string_builder& {return insert(index, basic_string_builder {value}, 0, count);}
1026 auto insert(size_type index, xtd::byte value) -> basic_string_builder& {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1046 auto insert(size_type index, double value) -> basic_string_builder& {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1056 auto insert(size_type index, xtd::single value) -> basic_string_builder& {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1066 auto insert(size_type index, xtd::int16 value) -> basic_string_builder& {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1076 auto insert(size_type index, xtd::int32 value) -> basic_string_builder& {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1086 auto insert(size_type index, xtd::int64 value) -> basic_string_builder& {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1096 auto insert(size_type index, xtd::sbyte value) -> basic_string_builder& {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1106 auto insert(size_type index, xtd::uint16 value) -> basic_string_builder& {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1116 auto insert(size_type index, xtd::uint32 value) -> basic_string_builder& {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1126 auto insert(size_type index, xtd::uint64 value) -> basic_string_builder& {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1136 auto insert(size_type index, value_type value) -> basic_string_builder& {return insert(index, 1, value);}
1147 auto insert(size_type index, value_type value, size_type repeat_count) -> basic_string_builder& {return insert(index, repeat_count, value);}
1148
1150 auto insert(size_type index, xtd::slong value) -> basic_string_builder& {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1151 auto insert(size_type index, xtd::ulong value) -> basic_string_builder& {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1153
1164 template<typename object_t>
1165 auto insert(size_type index, object_t value) -> basic_string_builder& {return insert(index, xtd::basic_string<char_t>::format("{}", value));}
1179
1200 auto insert(size_type index, const basic_string_builder & str) -> basic_string_builder& {return insert(index, str, 0, str.length());}
1209 auto insert(size_type index, const basic_string_builder & str, size_type s_index, size_type count) -> basic_string_builder& {
1212 if (s_index > str.length() || s_index + count > str.length()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range);
1213 chars_.insert(index, str.chars_, s_index, count);
1214 return self_;
1215 }
1223 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);}
1224
1232 auto remove(size_type start_index, size_type length) -> basic_string_builder& {return erase(start_index, length);}
1233
1239 auto replace(value_type old_char, value_type new_char) noexcept -> basic_string_builder& {return replace(old_char, new_char, 0, length());}
1247 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);}
1254 auto replace(const xtd::basic_string<char_t>& old_value, const xtd::basic_string<char_t>& new_value) noexcept -> basic_string_builder& {return replace(old_value, new_value, 0, length());}
1263 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& {
1265 auto old_size = old_value.length();
1266 auto new_size = new_value.length();
1267 auto index = xtd::usize {0};
1268 while (true) {
1269 index = chars_.find(old_value, index);
1270 if (index == npos || index >= start_index + count) break;
1271 if (index >= start_index) {
1272 if (old_size == new_size) replace(index, old_size, new_value);
1273 else {
1274 chars_.erase(index, old_value.length());
1275 insert(index, new_value);
1276 }
1277 }
1278 index += new_value.length();
1279 }
1280 return self_;
1281 }
1282
1291 chars_.replace(pos, count, str);
1292 return self_;
1293 }
1294
1302 chars_.replace(first, last, str);
1303 return self_;
1304 }
1315 chars_.replace(pos, count, str, pos2);
1316 return self_;
1317 }
1318
1328 if (pos2 > str.length() || pos2 + count2 > str.length()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range);
1329 chars_.replace(pos, count, str, pos2, count2);
1330 return self_;
1331 }
1332
1341 chars_.replace(pos, count, cstr, count2);
1342 return self_;
1343 }
1344
1354 chars_.replace(first, last, cstr, count2);
1355 return self_;
1356 }
1364 chars_.replace(pos, count, cstr);
1365 return self_;
1366 }
1367
1374 chars_.replace(first, last, cstr);
1375 return self_;
1376 }
1385 chars_.replace(pos, count, count2, ch);
1386 return self_;
1387 }
1388
1396 chars_.replace(first, last, count2, ch);
1397 return self_;
1398 }
1407 template<typename input_iterator_t>
1408 auto replace(const_iterator first, const_iterator last, input_iterator_t first2, input_iterator_t last2) -> basic_string_builder& {
1409 chars_.replace(first, last, first2, last2);
1410 return self_;
1411 }
1419 auto replace(const_iterator first, const_iterator last, std::initializer_list<value_type> ilist) -> basic_string_builder& {
1420 chars_.replace(first, last, ilist);
1421 return self_;
1422 }
1423
1427 //xtd::string to_string() const noexcept override {return __xtd_convert_to_string<char>(chars_);}
1428 [[nodiscard]] auto to_string() const noexcept -> xtd::string override {return xtd::string {chars_};}
1430
1432
1434
1436
1438
1446 return chars_[index == epos ? length() - 1 : index];
1447 }
1448
1454 return chars_[index == epos ? length() - 1 : index];
1455 }
1456
1459 operator const base_type& () const noexcept {return chars_;}
1462 operator base_type& () noexcept {return chars_;}
1463
1468 chars_ = str.chars_;
1469 return self_;
1470 }
1471
1476 chars_ = std::move(str.chars_);
1477 return self_;
1478 }
1479
1483 auto operator =(const std::basic_string<value_type>& str) noexcept -> basic_string_builder& {
1484 chars_ = str;
1485 return self_;
1486 }
1487
1491 auto operator =(std::basic_string<value_type>&& str) noexcept -> basic_string_builder& {
1492 chars_ = std::move(str);
1493 return self_;
1494 }
1495
1500 chars_ = str;
1501 return self_;
1502 }
1503
1508 chars_ = std::move(str);
1509 return self_;
1510 }
1511
1521
1526 chars_ = character;
1527 return self_;
1528 }
1529
1533 auto operator =(const std::initializer_list<value_type>& il) -> basic_string_builder& {
1534 chars_ = il;
1535 return self_;
1536 }
1537
1542 chars_ += str.chars_;
1543 return self_;
1544 }
1545
1550 chars_ += std::move(str.chars_);
1551 str.chars_.clear();
1552 return self_;
1553 }
1554
1563
1568 chars_ += ch;
1569 return self_;
1570 }
1571
1577 auto result = lhs;
1578 result += rhs;
1579 return result;
1580 }
1581
1587 auto result = std::move(lhs);
1588 result += std::move(rhs);
1589 return result;
1590 }
1591
1597 auto result = std::move(lhs);
1598 result += rhs;
1599 return result;
1600 }
1601
1607 auto result = lhs;
1608 result += std::move(rhs);
1609 return result;
1610 }
1611
1617 auto result = lhs;
1618 result += rhs;
1619 return result;
1620 }
1621
1627 auto result = std::move(lhs);
1628 result += rhs;
1629 return result;
1630 }
1631
1637 return lhs + rhs.chars_;
1638 }
1639
1645 return lhs + std::move(rhs).chars_;
1646 }
1647
1653 auto result = lhs;
1654 result += rhs;
1655 return result;
1656 }
1657
1663 auto result = std::move(lhs);
1664 result += rhs;
1665 return result;
1666 }
1667
1673 auto result = basic_string_builder(1, lhs);
1674 result += rhs;
1675 return result;
1676 }
1677
1683 auto result = basic_string_builder(1, lhs);
1684 result += std::move(rhs);
1685 return result;
1686 }
1687
1696 //friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string_builder& str) {return stream << str.to_string().chars_;}
1697 friend auto operator <<(std::ostream& stream, const basic_string_builder & str) -> std::ostream& {return stream << xtd::basic_string<char>(str.chars()).chars();}
1704 friend auto operator <<(std::wostream& stream, const basic_string_builder & str) -> std::wostream& {return stream << xtd::basic_string<xtd::wchar>(str.chars()).chars();}
1705
1714 friend auto operator >>(std::istream& stream, basic_string_builder & str) -> std::istream& {
1715 auto s = std::string {};
1716 stream >> s;
1718 return stream;
1719 }
1720
1728 friend auto operator >>(std::wistream& stream, basic_string_builder & str) -> std::wistream& {
1729 auto s = std::basic_string<xtd::wchar> {};
1730 stream >> s;
1732 return stream;
1733 }
1734
1735
1736 private:
1737 base_type chars_;
1738 size_type max_capacity_ = chars_.max_size();
1739 };
1740 }
1741}
Contains xtd::basic_string class.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
Represents text as a sequence of character units.
Definition basic_string.hpp:66
static auto join(const basic_string &separator, const collection_t &values) noexcept -> basic_string
Concatenates a specified separator basic_string between each element of a specified object array,...
Definition basic_string.hpp:1258
auto chars() const noexcept -> const base_type &
Returns a reference to the underlying base type.
Definition basic_string.hpp:357
static auto new_line() noexcept -> xtd::string
Gets the newline string defined for this environment.
static auto combine(args_t... values) noexcept -> xtd::usize
Combines values into a hash code.
Definition hash_code.hpp:70
static auto throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current()) -> void
Throws an exption with specified exception case.
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
object()=default
Create a new instance of the ultimate base class object.
Represents a mutable string of characters. This class cannot be inherited.
Definition basic_string_builder.hpp:32
auto chars() const noexcept -> const base_type &
Definition basic_string_builder.hpp:362
typename base_type::size_type size_type
Represents the basic string size type.
Definition basic_string_builder.hpp:47
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.
Definition basic_string_builder.hpp:485
auto append(std::initializer_list< value_type > ilist) -> basic_string_builder &
Appends additional characters to the string.
Definition basic_string_builder.hpp:867
auto append(size_type count, value_type ch) -> basic_string_builder &
Appends additional characters to the string.
Definition basic_string_builder.hpp:786
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 spec...
Definition basic_string_builder.hpp:1076
auto to_string() const noexcept -> xtd::string override
Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count,...
Definition basic_string_builder.hpp:1428
static constexpr size_type npos
Definition basic_string_builder.hpp:81
typename base_type::difference_type difference_type
Represents the basic string difference type.
Definition basic_string_builder.hpp:49
auto c_str() const noexcept -> const_pointer
Returns a pointer to a null-terminated character array with data equivalent to those stored in the st...
Definition basic_string_builder.hpp:343
auto replace(value_type old_char, value_type new_char, size_type start_index, size_type count) -> basic_string_builder &
Replaces, within a substring of this instance, all occurrences of a specified character with another ...
Definition basic_string_builder.hpp:1247
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.hpp:307
auto append(object_t value) -> basic_string_builder &
Appends the string representation of a specified object to this instance.
Definition basic_string_builder.hpp:776
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...
Definition basic_string_builder.hpp:1056
auto append(double value) -> basic_string_builder &
Appends the string representation of a specified double value to this instance.
Definition basic_string_builder.hpp:562
auto max_capacity() const noexcept -> size_type
Definition basic_string_builder.hpp:424
auto end() const -> const_iterator
Returns an iterator to the character following the last character of the string. This character acts ...
Definition basic_string_builder.hpp:395
auto get_base_type() const noexcept -> const base_type &
Returns the underlying base type.
Definition basic_string_builder.hpp:980
typename base_type::traits_type traits_type
Represents the basic string traits type.
Definition basic_string_builder.hpp:41
basic_string_builder(const xtd::basic_string< value_type > &value, xtd::usize start_index, xtd::usize length, xtd::usize capacity)
Initializes a new instance of the xtd::text::basic_string_builder class from the specified substring ...
Definition basic_string_builder.hpp:186
basic_string_builder(const basic_string_builder &str, xtd::usize index)
Initializes a new instance of xtd::text::basic_string_builder with specified substring at index.
Definition basic_string_builder.hpp:204
static constexpr xtd::usize bpos
Definition basic_string_builder.hpp:91
auto get_hash_code() const noexcept -> xtd::usize override
Returns the hash code for this basic_string_builder.
Definition basic_string_builder.hpp:984
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 sp...
Definition basic_string_builder.hpp:1106
basic_string_builder(const_pointer str, xtd::usize count, const allocator_type &allocator)
Initializes a new instance of xtd::text::basic_string_builder with specified substring,...
Definition basic_string_builder.hpp:290
auto copy_to(xtd::usize source_index, xtd::array< value_type > &destination, xtd::usize destination_index, xtd::usize destination_count) const -> void
Copies the characters from a specified segment of this instance to a specified segment of a destinati...
Definition basic_string_builder.hpp:952
auto capacity() const noexcept -> size_type
Definition basic_string_builder.hpp:347
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 memb...
Definition basic_string_builder.hpp:900
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.hpp:301
auto begin() -> iterator
Returns an iterator to the first character of the string.
Definition basic_string_builder.hpp:333
auto append(const basic_string_builder &str) -> basic_string_builder &
Appends additional characters to the string.
Definition basic_string_builder.hpp:795
basic_string_builder(xtd::usize capacity)
Initializes a new instance of the xtd::text::basic_string_builder class using the specified capacity.
Definition basic_string_builder.hpp:133
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.hpp:157
auto append(xtd::uint32 value) -> basic_string_builder &
Appends the string representation of a specified 32-bit unsigned integer value to this instance.
Definition basic_string_builder.hpp:696
static constexpr xtd::usize epos
Definition basic_string_builder.hpp:109
auto append(input_iterator_t first, input_iterator_t last) -> basic_string_builder &
Appends additional characters to the string.
Definition basic_string_builder.hpp:855
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.hpp:297
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 specifie...
Definition basic_string_builder.hpp:1136
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::...
Definition basic_string_builder.hpp:910
auto append(xtd::int16 value) -> basic_string_builder &
Appends the string representation of a specified 16-bit signed integer value to this instance.
Definition basic_string_builder.hpp:600
typename base_type::const_pointer const_pointer
Represents the basic string const pointer type.
Definition basic_string_builder.hpp:57
auto end() -> iterator
Returns an iterator to the character following the last character of the string. This character acts ...
Definition basic_string_builder.hpp:398
basic_string_builder(xtd::usize capacity, xtd::usize max_capacity)
Initializes a new instance of the xtd::text::basic_string_builder class that starts with a specified ...
Definition basic_string_builder.hpp:148
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.hpp:244
basic_string_builder(const basic_string_builder &str, xtd::usize 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.hpp:213
auto append(xtd::sbyte value) -> basic_string_builder &
Appends the string representation of a specified 8-bit signed integer value to this instance.
Definition basic_string_builder.hpp:658
basic_string_builder(const basic_string_builder &str, xtd::usize index, xtd::usize count, const allocator_type &allocator)
Initializes a new instance of xtd::text::basic_string_builder with specified substring at index,...
Definition basic_string_builder.hpp:233
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,...
Definition basic_string_builder.hpp:1383
auto replace(size_type pos, size_type count, const basic_string_builder &str) -> basic_string_builder &
Replaces all occurrences of a specified string in this instance with another specified string.
Definition basic_string_builder.hpp:1289
basic_string_builder()=default
Initializes a new instance of xtd::text::basic_string_builder.
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 spec...
Definition basic_string_builder.hpp:1086
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 sp...
Definition basic_string_builder.hpp:1116
auto append(xtd::decimal value) -> basic_string_builder &
Appends the string representation of a specified decimal value to this instance.
Definition basic_string_builder.hpp:543
basic_string_builder(const xtd::basic_string< value_type > &value, xtd::usize capacity)
Initializes a new instance of the xtd::text::basic_string_builder class using the specified string an...
Definition basic_string_builder.hpp:169
auto append(xtd::int64 value) -> basic_string_builder &
Appends the string representation of a specified 64-bit signed integer value to this instance.
Definition basic_string_builder.hpp:638
typename base_type::const_reference const_reference
Represents the basic string const referecne type.
Definition basic_string_builder.hpp:53
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 positi...
Definition basic_string_builder.hpp:1006
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,...
Definition basic_string_builder.hpp:1326
auto data() noexcept -> pointer
Returns a pointer to the underlying array serving as character storage. The pointer is such that the ...
Definition basic_string_builder.hpp:387
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 inst...
Definition basic_string_builder.hpp:1147
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...
Definition basic_string_builder.hpp:1046
auto append_line() -> basic_string_builder &
Appends the default line terminator to the end of the current xtd::text::basic_string_builder object.
Definition basic_string_builder.hpp:925
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,...
Definition basic_string_builder.hpp:1312
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 specifi...
Definition basic_string_builder.hpp:973
auto operator[](xtd::usize index) const -> const_reference
Returns a reference to the character at specified location index.
Definition basic_string_builder.hpp:1444
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 curr...
Definition basic_string_builder.hpp:933
friend auto operator<<(std::ostream &stream, const basic_string_builder &str) -> std::ostream &
Output stream operator. Behaves as a FormattedOutputFunction. After constructing and checking the sen...
Definition basic_string_builder.hpp:1697
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 charact...
Definition basic_string_builder.hpp:1036
typename base_type::reference reference
Represents the basic string referecne type.
Definition basic_string_builder.hpp:51
auto append(xtd::boolean value) -> basic_string_builder &
Appends the string representation of a specified boolean value to this instance.
Definition basic_string_builder.hpp:504
basic_string_builder(const_pointer str, xtd::usize count)
Initializes a new instance of xtd::text::basic_string_builder with specified substring and count char...
Definition basic_string_builder.hpp:282
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 sp...
Definition basic_string_builder.hpp:1126
auto chars() noexcept -> base_type &
Returns a reference to the underlying base type.
Definition basic_string_builder.hpp:366
auto append(xtd::single value) -> basic_string_builder &
Appends the string representation of a specified single value to this instance.
Definition basic_string_builder.hpp:581
auto data() const noexcept -> const_pointer
Returns a pointer to the underlying array serving as character storage. The pointer is such that the ...
Definition basic_string_builder.hpp:379
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.hpp:240
auto append(xtd::uint64 value) -> basic_string_builder &
Appends the string representation of a specified 64-bit unsigned integer value to this instance.
Definition basic_string_builder.hpp:715
auto append(const xtd::basic_string< char_t > &value) -> basic_string_builder &
Appends a copy of the specified string to this instance.
Definition basic_string_builder.hpp:453
typename base_type::pointer pointer
Represents the basic string pointer type.
Definition basic_string_builder.hpp:55
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 spec...
Definition basic_string_builder.hpp:1066
auto append(const_pointer s, size_type count) -> basic_string_builder &
Appends additional characters to the string.
Definition basic_string_builder.hpp:836
auto append(xtd::uint16 value) -> basic_string_builder &
Appends the string representation of a specified 16-bit unsigned integer value to this instance.
Definition basic_string_builder.hpp:677
typename base_type::iterator iterator
Represents the basic string iterator type.
Definition basic_string_builder.hpp:60
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 form...
Definition basic_string_builder.hpp:889
auto length(size_type value) noexcept -> basic_string_builder &
Sets or sets the length of the current xtd::text::basic_string_builder object.
Definition basic_string_builder.hpp:417
auto capacity(size_type value) -> basic_string_builder &
Sets the number of characters that the string has currently allocated space for.
Definition basic_string_builder.hpp:350
basic_string_builder(value_type character, xtd::usize 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.hpp:264
auto append(const basic_string_builder &str, size_type pos) -> basic_string_builder &
Appends additional characters to the string.
Definition basic_string_builder.hpp:807
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.hpp:194
auto cend() const -> const_iterator
Returns an iterator to the character following the last character of the string. This character acts ...
Definition basic_string_builder.hpp:370
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.hpp:268
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.hpp:190
auto empty() const noexcept -> bool
Checks if the string has no characters, i.e. whether begin() == end().
Definition basic_string_builder.hpp:391
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.hpp:313
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.hpp:317
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 spe...
Definition basic_string_builder.hpp:1026
auto insert(size_type index, const_pointer s, size_type count) -> basic_string_builder &
Inserts characters into the string.
Definition basic_string_builder.hpp:1193
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...
Definition basic_string_builder.hpp:961
auto size() const noexcept -> size_type
Returns the number of char_t elements in the string, i.e. std::distance(begin(), end()).
Definition basic_string_builder.hpp:428
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 speci...
Definition basic_string_builder.hpp:1096
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.
Definition basic_string_builder.hpp:995
basic_string_builder(const basic_string_builder &str, xtd::usize index, xtd::usize count)
Initializes a new instance of xtd::text::basic_string_builder with specified substring at index and c...
Definition basic_string_builder.hpp:223
auto append(xtd::byte value) -> basic_string_builder &
Appends the string representation of a specified 8-bit unsigned value to this instance.
Definition basic_string_builder.hpp:524
auto append(value_type value) -> basic_string_builder &
Appends the string representation of a specified xtd::text::basic_string_builder::value_type value to...
Definition basic_string_builder.hpp:738
auto operator+=(const basic_string_builder &str) -> basic_string_builder &
Addition assignment operator. Appends additional characters to the string.
Definition basic_string_builder.hpp:1541
std::basic_string< char_t, traits_t, allocator_t > base_type
Represents the basic string base type.
Definition basic_string_builder.hpp:39
auto append(xtd::int32 value) -> basic_string_builder &
Appends the string representation of a specified 32-bit signed integer value to this instance.
Definition basic_string_builder.hpp:619
friend auto operator+(const basic_string_builder &lhs, const basic_string_builder &rhs) -> basic_string_builder
Addition operator. Returns a string containing characters from lhs followed by the characters from rh...
Definition basic_string_builder.hpp:1576
auto remove(size_type start_index, size_type length) -> basic_string_builder &
Inserts characters into the string.
Definition basic_string_builder.hpp:1232
auto replace(value_type old_char, value_type new_char) noexcept -> basic_string_builder &
Replaces all occurrences of a specified character in this instance with another specified character.
Definition basic_string_builder.hpp:1239
basic_string_builder(value_type character, xtd::usize count)
Initializes a new instance of xtd::text::basic_string_builder with specified count copies of characte...
Definition basic_string_builder.hpp:259
auto cbegin() const -> const_iterator
Returns an iterator to the first character of the string.
Definition basic_string_builder.hpp:358
auto insert(size_type index, const basic_string_builder &str) -> basic_string_builder &
Inserts characters into the string.
Definition basic_string_builder.hpp:1200
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.hpp:322
basic_string_builder(xtd::usize 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.hpp:254
auto clear() -> basic_string_builder &
Removes all characters from the current xtd::text::basic_string_builder instance.
Definition basic_string_builder.hpp:939
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...
Definition basic_string_builder.hpp:1165
typename base_type::const_reverse_iterator const_reverse_iterator
Represents the basic string const reverse iterator type.
Definition basic_string_builder.hpp:67
auto operator=(const basic_string_builder &str) noexcept -> basic_string_builder &
Copy assignment operator. Replaces the contents with a copy of the contents of str.
Definition basic_string_builder.hpp:1467
auto append(const_pointer s) -> basic_string_builder &
Appends additional characters to the string.
Definition basic_string_builder.hpp:845
typename base_type::const_iterator const_iterator
Represents the basic string const iterator type.
Definition basic_string_builder.hpp:63
auto begin() const -> const_iterator
Returns an iterator to the first character of the string.
Definition basic_string_builder.hpp:330
auto append(const basic_string_builder &str, size_type pos, size_type count) -> basic_string_builder &
Appends additional characters to the string.
Definition basic_string_builder.hpp:820
basic_string_builder(xtd::usize count, value_type character)
Definition basic_string_builder.hpp:249
typename base_type::allocator_type allocator_type
Represents the basic string allocator type.
Definition basic_string_builder.hpp:45
typename base_type::reverse_iterator reverse_iterator
Represents the basic string reverse iterator type.
Definition basic_string_builder.hpp:65
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 th...
Definition basic_string_builder.hpp:966
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.hpp:275
auto replace(size_type pos, size_type count, const_pointer cstr) -> basic_string_builder &
Replaces the characters in the range [begin() + pos, begin() + std::min(pos + count,...
Definition basic_string_builder.hpp:1363
friend auto operator>>(std::istream &stream, basic_string_builder &str) -> std::istream &
Input stream operator. Behaves as a FormattedInputFunction. After constructing and checking the sentr...
Definition basic_string_builder.hpp:1714
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.hpp:198
auto length() const noexcept -> size_type
Definition basic_string_builder.hpp:407
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 po...
Definition basic_string_builder.hpp:1016
typename base_type::value_type value_type
Represents the basic string value type.
Definition basic_string_builder.hpp:43
auto insert(size_type index, size_type count, value_type ch) -> basic_string_builder &
Inserts characters into the string.
Definition basic_string_builder.hpp:1173
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,...
Definition basic_string_builder.hpp:1339
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 inst...
Definition basic_string_builder.hpp:758
Definition character.hpp:17
Contains xtd::environment class.
static auto format(const basic_string< char > &fmt, args_t &&... args) -> basic_string
Writes the text representation of the specified arguments list, to string using the specified format ...
auto format(const xtd::string &fmt, args_t &&... args) -> xtd::string
Writes the text representation of the specified arguments list, to string using the specified format ...
Definition format.hpp:21
@ index_out_of_range
The index is out of range.
Definition exception_case.hpp:61
@ argument_out_of_range
The argument is out of range.
Definition exception_case.hpp:35
@ null_pointer
The pointer is null.
Definition exception_case.hpp:79
#define self_
The self_ expression is a reference value expression whose value is the reference of the implicit obj...
Definition self.hpp:20
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
std::int64_t int64
Represents a 64-bit signed integer.
Definition int64.hpp:23
std::uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
__slong__ slong
Represents a 32-bit or 64-bit signed integer.
Definition slong.hpp:27
null_ptr null
Represents a null pointer value.
std::int8_t sbyte
Represents a 8-bit signed integer.
Definition sbyte.hpp:23
bool boolean
Represents a boolean.
Definition boolean.hpp:23
__ulong__ ulong
Represents a 32-bit or 64-bit unsigned integer.
Definition ulong.hpp:27
long double decimal
Represents a decimal-precision floating-point number.
Definition decimal.hpp:23
std::uint16_t uint16
Represents a 16-bit unsigned integer.
Definition uint16.hpp:23
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:25
std::int16_t int16
Represents a 16-bit signed integer.
Definition int16.hpp:23
std::uint64_t uint64
Represents a 64-bit unsigned integer.
Definition uint64.hpp:23
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
std::uint8_t byte
Represents a 8-bit unsigned integer.
Definition byte.hpp:23
float single
Represents a single-precision floating-point number.
Definition single.hpp:23
@ s
The S key.
Definition console_key.hpp:124
@ separator
The Separator key.
Definition console_key.hpp:172
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
auto first() const -> read_only_span< type_t, count >
Obtains a subspan consisting of the first count elements of the sequence.
Definition read_only_span.hpp:249
xtd::usize size_type
Represents the read_only_span size type (usually xtd::usize).
Definition read_only_span.hpp:59
auto last() const -> read_only_span< type_t, count >
Obtains a subspan consisting of the last N elements of the sequence.
Definition read_only_span.hpp:274
constexpr auto length() const noexcept -> size_type
Returns the length of the current read_only_span.
Definition read_only_span.hpp:213
const type_t * const_pointer
Represents the read_only_span const pointer type.
Definition read_only_span.hpp:65
constexpr auto size() const noexcept -> size_type
Returns the number of elements.
Definition read_only_span.hpp:217
const xtd::collections::generic::helpers::wrap_pointer_iterator< pointer > const_iterator
Represents the const iterator of read_only_span value type.
Definition read_only_span.hpp:73
Contains xtd numeric literals.
Represents a value_type struct.
Definition value_type.hpp:34