xtd 0.2.0
basic_string.hpp
Go to the documentation of this file.
1
4#pragma once
6#define __XTD_CORE_INTERNAL__
11#undef __XTD_CORE_INTERNAL__
12#define __XTD_STD_INTERNAL__
14#undef __XTD_STD_INTERNAL__
17#include "hash_code.hpp"
18#include "icomparable.hpp"
19#include "iequatable.hpp"
20#include "null.hpp"
21#include "string_comparison.hpp"
23#include "types.hpp"
24#include "object.hpp"
25#include "parse.hpp"
26#include "to_string.hpp"
27#include "types.hpp"
28#include "unused.hpp"
29#include <cctype>
30#if defined(__xtd__cpp_lib_format)
31#include <format>
32#endif
33#include <iomanip>
34#include <ostream>
35#include <sstream>
36#include <string>
37
39template<class ...args_t>
40void __basic_string_extract_format_arg(xtd::basic_string<char>& fmt, xtd::array<__format_information<char >> & formats, args_t&&... args);
41template<class target_t, class source_t>
42std::basic_string<target_t> __xtd_convert_to_string(std::basic_string<source_t>&& str) noexcept;
43template<class target_t, class source_t>
44std::basic_string<target_t> __xtd_convert_to_string(const std::basic_string<source_t>& str) noexcept;
45std::basic_string<char> __xtd_demangle(const std::basic_string<char>& value) noexcept;
46std::basic_string<char> __xtd_get_class_name(const std::type_info& value) noexcept;
47std::basic_string<char> __xtd_get_full_class_name(const std::type_info& value) noexcept;
49
51namespace xtd {
70 template<class char_t, class traits_t, class allocator_t>
71 class basic_string : public object, public xtd::icomparable<basic_string<char_t, traits_t, allocator_t>>, public xtd::iequatable<basic_string<char_t, traits_t, allocator_t >>, public xtd::collections::generic::ienumerable<char_t> {
72 public:
74
78 using base_type = std::basic_string<char_t, traits_t, allocator_t>;
80 using traits_type = typename base_type::traits_type;
82 using value_type = typename base_type::value_type;
84 using allocator_type = typename base_type::allocator_type;
86 using size_type = typename base_type::size_type;
88 using difference_type = typename base_type::difference_type;
90 using reference = typename base_type::reference;
92 using const_reference = typename base_type::const_reference;
94 using pointer = typename base_type::pointer;
96 using const_pointer = typename base_type::const_pointer;
104 using reverse_iterator = typename base_type::reverse_iterator;
106 using const_reverse_iterator = typename base_type::const_reverse_iterator;
108 using enumerator_type = typename xtd::collections::generic::enumerator<value_type>;
110
112
116 static const basic_string empty_string;
117
119 inline static constexpr size_type npos = base_type::npos;
121
123
126 basic_string() = default;
129 explicit basic_string(const allocator_type & allocator) noexcept;
130
133 basic_string(const basic_string<char>& str) noexcept {
134 if constexpr(std::is_same_v<char, char_t>) chars_ = str.chars_;
135 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
136 }
137
140 basic_string(const basic_string<xtd::char16>& str) noexcept {
141 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = str.chars_;
142 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
143 }
146 basic_string(const basic_string<xtd::char32>& str) noexcept {
147 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = str.chars_;
148 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
149 }
152 basic_string(const basic_string<xtd::char8>& str) noexcept {
153 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = str.chars_;
154 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
155 }
158 basic_string(const basic_string<xtd::wchar>& str) noexcept {
159 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = str.chars_;
160 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
161 }
162
166 basic_string(const basic_string<char>& str, const allocator_type & allocator) noexcept {
167 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, allocator);
168 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
169 }
173 basic_string(const basic_string<xtd::char16>& str, const allocator_type & allocator) noexcept {
174 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, allocator);
175 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
176 }
180 basic_string(const basic_string<xtd::char32>& str, const allocator_type & allocator) noexcept {
181 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, allocator);
182 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
183 }
187 basic_string(const basic_string<xtd::char8>& str, const allocator_type & allocator) noexcept {
188 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, allocator);
189 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
190 }
194 basic_string(const basic_string<xtd::wchar>& str, const allocator_type & allocator) noexcept {
195 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, allocator);
196 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
197 }
198
203 basic_string(const basic_string<char>& str, xtd::size index) {
205 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index);
206 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index)));
207 }
214 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index);
215 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index)));
216 }
223 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index);
224 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index)));
225 }
232 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index);
233 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index)));
234 }
241 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index);
242 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index)));
243 }
244
250 basic_string(const basic_string<char>& str, xtd::size index, const allocator_type & allocator) {
252 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index, allocator);
253 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index)), allocator);
254 }
260 basic_string(const basic_string<xtd::char16>& str, xtd::size index, const allocator_type & allocator) {
262 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index, allocator);
263 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index)), allocator);
264 }
270 basic_string(const basic_string<xtd::char32>& str, xtd::size index, const allocator_type & allocator) {
272 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index, allocator);
273 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index)), allocator);
274 }
280 basic_string(const basic_string<xtd::char8>& str, xtd::size index, const allocator_type & allocator) {
282 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index, allocator);
283 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index)), allocator);
284 }
290 basic_string(const basic_string<xtd::wchar>& str, xtd::size index, const allocator_type & allocator) {
292 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index, allocator);
293 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index)), allocator);
294 }
295
303 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index, count);
304 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index, count)));
305 }
313 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index, count);
314 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index, count)));
315 }
323 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index, count);
324 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index, count)));
325 }
333 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index, count);
334 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index, count)));
335 }
343 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index, count);
344 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index, count)));
345 }
346
353 basic_string(const basic_string<char>& str, xtd::size index, xtd::size count, const allocator_type & allocator) {
355 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
356 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index, count)), allocator);
357 }
364 basic_string(const basic_string<xtd::char16>& str, xtd::size index, xtd::size count, const allocator_type & allocator) {
366 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
367 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index, count)), allocator);
368 }
375 basic_string(const basic_string<xtd::char32>& str, xtd::size index, xtd::size count, const allocator_type & allocator) {
377 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
378 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index, count)), allocator);
379 }
386 basic_string(const basic_string<xtd::char8>& str, xtd::size index, xtd::size count, const allocator_type & allocator) {
388 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
389 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index, count)), allocator);
390 }
397 basic_string(const basic_string<xtd::wchar>& str, xtd::size index, xtd::size count, const allocator_type & allocator) {
399 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
400 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index, count)), allocator);
401 }
402
405 basic_string(basic_string&&) = default;
406
410 basic_string(basic_string&& str, const allocator_type & allocator) noexcept : chars_(std::move(str.chars_)) {}
411
416 basic_string(xtd::size count, char character) : basic_string(std::basic_string<char>(count, character)) {}
421 basic_string(xtd::size count, char character, const allocator_type & allocator) : basic_string(std::basic_string<char>(count, character), allocator) {}
425 basic_string(xtd::size count, xtd::char16 character) : basic_string(std::basic_string<xtd::char16>(count, character)) {}
430 basic_string(xtd::size count, xtd::char16 character, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char16>(count, character), allocator) {}
434 basic_string(xtd::size count, xtd::char32 character) : basic_string(std::basic_string<xtd::char32>(count, character)) {}
439 basic_string(xtd::size count, xtd::char32 character, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char32>(count, character), allocator) {}
443 basic_string(xtd::size count, xtd::char8 character) : basic_string(std::basic_string<xtd::char8>(count, character)) {}
448 basic_string(xtd::size count, xtd::char8 character, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char8>(count, character), allocator) {}
452 basic_string(xtd::size count, xtd::wchar character) : basic_string(std::basic_string<xtd::wchar>(count, character)) {}
458 basic_string(xtd::size count, xtd::wchar character, const allocator_type & allocator) : basic_string(std::basic_string<xtd::wchar>(count, character), allocator) {}
459
463 basic_string(char character, xtd::size count) : basic_string(std::basic_string<char>(count, character)) {}
468 basic_string(char character, xtd::size count, const allocator_type & allocator) : basic_string(std::basic_string<char>(count, character), allocator) {}
472 basic_string(xtd::char16 character, xtd::size count) : basic_string(std::basic_string<xtd::char16>(count, character)) {}
477 basic_string(xtd::char16 character, xtd::size count, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char16>(count, character), allocator) {}
481 basic_string(xtd::char32 character, xtd::size count) : basic_string(std::basic_string<xtd::char32>(count, character)) {}
486 basic_string(xtd::char32 character, xtd::size count, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char32>(count, character), allocator) {}
490 basic_string(xtd::char8 character, xtd::size count) : basic_string(std::basic_string<xtd::char8>(count, character)) {}
495 basic_string(xtd::char8 character, xtd::size count, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char8>(count, character), allocator) {}
499 basic_string(xtd::wchar character, xtd::size count) : basic_string(std::basic_string<xtd::wchar>(count, character)) {}
504 basic_string(xtd::wchar character, xtd::size count, const allocator_type & allocator) : basic_string(std::basic_string<xtd::wchar>(count, character), allocator) {}
505
508 basic_string(const char* str) { // Can't be explicit by design.
510 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str);
511 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str));
512 }
515 basic_string(const xtd::char16 * str) { // Can't be explicit by design.
517 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str);
518 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str));
519 }
522 basic_string(const xtd::char32 * str) { // Can't be explicit by design.
524 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str);
525 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str));
526 }
529 basic_string(const xtd::char8 * str) { // Can't be explicit by design.
531 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str);
532 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str));
533 }
536 basic_string(const xtd::wchar * str) { // Can't be explicit by design.
538 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
539 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
540 }
541
545 basic_string(const char* str, const allocator_type & allocator) {
547 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str, allocator);
548 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str), allocator);
549 }
553 basic_string(const xtd::char16 * str, const allocator_type & allocator) {
555 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str, allocator);
556 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str), allocator);
557 }
561 basic_string(const xtd::char32 * str, const allocator_type & allocator) {
563 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str, allocator);
564 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str), allocator);
565 }
569 basic_string(const xtd::char8 * str, const allocator_type & allocator) {
571 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str, allocator);
572 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str), allocator);
573 }
577 basic_string(const xtd::wchar * str, const allocator_type & allocator) : chars_(allocator) {
579 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
580 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
581 }
582
585 basic_string(const char* str, xtd::size count) {
587 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str, count);
588 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str, count));
589 }
594 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str, count);
595 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str, count));
596 }
601 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str, count);
602 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str, count));
603 }
606 basic_string(const xtd::char8 * str, xtd::size count) {
608 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str, count);
609 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str, count));
610 }
613 basic_string(const xtd::wchar * str, xtd::size count) {
615 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str, count);
616 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str, count));
617 }
618
623 basic_string(const char* str, xtd::size count, const allocator_type & allocator) {
625 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str, count, allocator);
626 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str, count), allocator);
627 }
632 basic_string(const xtd::char16 * str, xtd::size count, const allocator_type & allocator) : chars_(allocator) {
634 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str, count, allocator);
635 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str, count), allocator);
636 }
641 basic_string(const xtd::char32 * str, xtd::size count, const allocator_type & allocator) : chars_(allocator) {
643 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str, count, allocator);
644 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str, count), allocator);
645 }
650 basic_string(const xtd::char8 * str, xtd::size count, const allocator_type & allocator) : chars_(allocator) {
652 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str, count, allocator);
653 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str, count), allocator);
654 }
659 basic_string(const xtd::wchar * str, xtd::size count, const allocator_type & allocator) : chars_(allocator) {
661 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str, count, allocator);
662 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str, count), allocator);
663 }
664
667 basic_string(const std::basic_string<char>& str) noexcept { // Can't be explicit by design.
668 if constexpr(std::is_same_v<char, char_t>) chars_ = str;
669 else chars_ = __xtd_convert_to_string<value_type>(str);
670 }
673 basic_string(const std::basic_string<xtd::char16>& str) noexcept { // Can't be explicit by design.
674 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = str;
675 else chars_ = __xtd_convert_to_string<value_type>(str);
676 }
679 basic_string(const std::basic_string<xtd::char32>& str) noexcept { // Can't be explicit by design.
680 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = str;
681 else chars_ = __xtd_convert_to_string<value_type>(str);
682 }
685 basic_string(const std::basic_string<xtd::char8>& str) noexcept { // Can't be explicit by design.
686 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = str;
687 else chars_ = __xtd_convert_to_string<value_type>(str);
688 }
691 basic_string(const std::basic_string<xtd::wchar>& str) noexcept { // Can't be explicit by design.
692 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = str;
693 else chars_ = __xtd_convert_to_string<value_type>(str);
694 }
695
699 basic_string(const std::basic_string<char>& str, const allocator_type & allocator) noexcept {
700 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str, allocator);
701 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
702 }
706 basic_string(const std::basic_string<xtd::char16>& str, const allocator_type & allocator) noexcept {
707 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str, allocator);
708 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
709 }
713 basic_string(const std::basic_string<xtd::char32>& str, const allocator_type & allocator) noexcept {
714 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str, allocator);
715 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
716 }
720 basic_string(const std::basic_string<xtd::char8>& str, const allocator_type & allocator) noexcept {
721 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str, allocator);
722 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
723 }
727 basic_string(const std::basic_string<xtd::wchar>& str, const allocator_type & allocator) noexcept {
728 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str, allocator);
729 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
730 }
731
735 template<class input_iterator_t>
736 basic_string(input_iterator_t first, input_iterator_t last) : chars_(first, last) {}
741 template<class input_iterator_t>
742 basic_string(input_iterator_t first, input_iterator_t last, const allocator_type & allocator) : chars_(first, last, allocator) {}
743
747 template<class string_view_like_t>
748 explicit constexpr basic_string(const string_view_like_t& string_view) : chars_(string_view) {}
752 template<class string_view_like_t>
753 explicit constexpr basic_string(const string_view_like_t& string_view, const allocator_type & allocator) : chars_(string_view, allocator) {}
759 template<class string_view_like_t>
760 constexpr basic_string(const string_view_like_t& string_view, size_type index, size_type count) : chars_(string_view, index, count) {}
766 template<class string_view_like_t>
767 constexpr basic_string(const string_view_like_t& string_view, size_type index, size_type count, const allocator_type & allocator) : chars_(string_view, index, count, allocator) {}
768
771 basic_string(std::initializer_list<char> il) : basic_string(std::basic_string<char>(il)) {}
774 basic_string(std::initializer_list<xtd::char16> il) : basic_string(std::basic_string<xtd::char16>(il)) {}
777 basic_string(std::initializer_list<xtd::char32> il) : basic_string(std::basic_string<xtd::char32>(il)) {}
780 basic_string(std::initializer_list<xtd::char8> il) : basic_string(std::basic_string<xtd::char8>(il)) {}
783 basic_string(std::initializer_list<xtd::wchar> il) : basic_string(std::basic_string<xtd::wchar>(il)) {}
784
788 basic_string(std::initializer_list<char> il, const allocator_type & allocator) : basic_string(std::basic_string<char>(il), allocator) {}
792 basic_string(std::initializer_list<xtd::char16> il, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char16>(il), allocator) {}
796 basic_string(std::initializer_list<xtd::char32> il, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char32>(il), allocator) {}
800 basic_string(std::initializer_list<xtd::char8> il, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char8>(il), allocator) {}
804 basic_string(std::initializer_list<xtd::wchar> il, const allocator_type & allocator) : basic_string(std::basic_string<xtd::wchar>(il), allocator) {}
806
808
813 const_reference back() const {return operator[](size() - 1);}
814
818
827 const_pointer c_str() const noexcept {return chars_.c_str();}
828
831 size_type capacity() const noexcept {return chars_.capacity();}
832
836
839 const_reverse_iterator crbegin() const {return chars_.crbegin();}
840
843 const base_type & chars() const noexcept {return chars_;}
844
848
851 const_reverse_iterator crend() const {return chars_.crend();}
852
860 const_pointer data() const noexcept {return chars_.data();}
861
864 bool empty() const noexcept {return chars_.empty();}
865
869
873 const_reference front() const {return operator[](0);}
874
878 size_type length() const noexcept {return chars_.size();}
879
882 size_type max_size() const noexcept {return chars_.max_size();}
883
886 const_reverse_iterator rbegin() const {return chars_.crbegin();}
887
890 const_reverse_iterator rend() const {return chars_.crend();}
891
894 size_type size() const noexcept {return chars_.size();}
896
898
903 const_reference at(size_type pos) const {return operator [](pos);}
904
923 int32 compare(const basic_string & str) const {return chars_.compare(str);}
945 int32 compare(size_type pos1, size_type count1, const basic_string & str) const {return chars_.compare(pos1, count1, str);}
969 int32 compare(size_type pos1, size_type count1, const basic_string & str, size_type pos2) const {return chars_.compare(pos1, count1, str, pos2);}
994 int32 compare(size_type pos1, size_type count1, const basic_string & str, size_type pos2, size_type count2) const {return chars_.compare(pos1, count1, str, pos2, count2);}
1013 int32 compare(const_pointer s) const {return chars_.compare(s);}
1035 int32 compare(size_type pos1, size_type count1, const_pointer s) const {return chars_.compare(pos1, count1, s);}
1058 int32 compare(size_type pos1, size_type count1, const_pointer s, size_type count2) const {return chars_.compare(pos1, count1, s, count2);}
1059
1069 int32 compare_to(const object & value) const {
1071 return compare_to(static_cast<const basic_string&>(value));
1072 }
1073
1081 int32 compare_to(const basic_string & value) const noexcept override {return chars_.compare(value.chars_);}
1082
1086 virtual bool contains(value_type value) const noexcept {return find(value) != npos;}
1090 virtual bool contains(const basic_string & value) const noexcept {return find(value) != npos;}
1091
1095 bool equals(const object & obj) const noexcept override {return dynamic_cast<const basic_string*>(&obj) && equals(static_cast<const basic_string&>(obj));}
1100 bool equals(const basic_string & value) const noexcept override {return equals(value, false);}
1106 bool equals(const basic_string & value, bool ignore_case) const noexcept {
1107 if (ignore_case) return to_upper().chars_ == value.to_upper().chars_;
1108 return chars_ == value.chars_;
1109 }
1110
1114 bool ends_with(value_type value) const noexcept {return ends_with(value, false);}
1119 bool ends_with(value_type value, bool ignore_case) const noexcept {
1120 if (ignore_case) return to_lower().rfind(static_cast<value_type>(tolower(value))) == size() - 1;
1121 return rfind(value) == size() - 1;
1122 }
1123
1126 bool ends_with(const basic_string & value) const noexcept {return ends_with(value, xtd::string_comparison::ordinal);}
1131 bool ends_with(const basic_string & value, bool ignore_case) const noexcept {return ends_with(value, ignore_case ? xtd::string_comparison::ordinal_ignore_case : xtd::string_comparison::ordinal);}
1136 bool ends_with(const basic_string & value, xtd::string_comparison comparison_type) const noexcept {
1137 if (comparison_type == xtd::string_comparison::ordinal_ignore_case) return to_lower().rfind(value.to_lower()) + value.to_lower().size() == size();
1138 return rfind(value) + value.size() == size();
1139 }
1140
1144 size_type find(const basic_string & str) const {return chars_.find(str);}
1150 size_type find(const basic_string & str, size_type pos) const {return chars_.find(str, pos);}
1158 size_type find(const_pointer s, size_type pos, size_type count) const {return chars_.find(s, pos, count);}
1164 size_type find(const_pointer s) const {return chars_.find(s);}
1171 size_type find(const_pointer s, size_type pos) const {return chars_.find(s, pos);}
1176 size_type find(value_type ch) const {return chars_.find(ch);}
1182 size_type find(value_type ch, size_type pos) const {return chars_.find(ch, pos);}
1183
1188 size_type find_first_of(const basic_string & str) const {return chars_.find_first_of(str);}
1194 size_type find_first_of(const basic_string & str, size_type pos) const {return chars_.find_first_of(str, pos);}
1202 size_type find_first_of(const_pointer s, size_type pos, size_type count) const {return chars_.find_first_of(s, pos, count);}
1208 size_type find_first_of(const_pointer s) const {return chars_.find_first_of(s);}
1215 size_type find_first_of(const_pointer s, size_type pos) const {return chars_.find_first_of(s, pos);}
1220 size_type find_first_of(char_t ch) const {return chars_.find_first_of(ch);}
1226 size_type find_first_of(char_t ch, size_type pos) const {return chars_.find_first_of(ch, pos);}
1227
1232 size_type find_first_not_of(const basic_string & str) const {return chars_.find_first_not_of(str);}
1238 size_type find_first_not_of(const basic_string & str, size_type pos) const {return chars_.find_first_not_of(str, pos);}
1246 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);}
1252 size_type find_first_not_of(const_pointer s) const {return chars_.find_first_not_of(s);}
1259 size_type find_first_not_of(const_pointer s, size_type pos) const {return chars_.find_first_not_of(s, pos);}
1264 size_type find_first_not_of(char_t ch) const {return chars_.find_first_not_of(ch);}
1270 size_type find_first_not_of(char_t ch, size_type pos) const {return chars_.find_first_not_of(ch, pos);}
1271
1276 size_type find_last_of(const basic_string & str) const {return chars_.find_last_of(str);}
1282 size_type find_last_of(const basic_string & str, size_type pos) const {return chars_.find_last_of(str, pos);}
1290 size_type find_last_of(const_pointer s, size_type pos, size_type count) const {return chars_.find_last_of(s, pos, count);}
1296 size_type find_last_of(const_pointer s) const {return chars_.find_last_of(s);}
1303 size_type find_last_of(const_pointer s, size_type pos) const {return chars_.find_last_of(s, pos);}
1308 size_type find_last_of(char_t ch) const {return chars_.find_last_of(ch);}
1314 size_type find_last_of(char_t ch, size_type pos) const {return chars_.find_last_of(ch, pos);}
1315
1320 size_type find_last_not_of(const basic_string & str) const {return chars_.find_last_not_of(str);}
1326 size_type find_last_not_of(const basic_string & str, size_type pos) const {return chars_.find_last_not_of(str, pos);}
1334 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);}
1340 size_type find_last_not_of(const_pointer s) const {return chars_.find_last_not_of(s);}
1347 size_type find_last_not_of(const_pointer s, size_type pos) const {return chars_.find_last_not_of(s, pos);}
1352 size_type find_last_not_of(char_t ch) const {return chars_.find_last_not_of(ch);}
1358 size_type find_last_not_of(char_t ch, size_type pos) const {return chars_.find_last_not_of(ch, pos);}
1359
1362 allocator_type get_allocator() const {return chars_.get_allocator();}
1363
1366 virtual const base_type & get_base_type() const noexcept {return chars_;}
1367
1370 xtd::size get_hash_code() const noexcept override {return xtd::hash_code::combine(chars_);}
1371
1372 enumerator_type get_enumerator() const noexcept override {
1373 class basic_string_enumerator : public xtd::collections::generic::ienumerator<value_type> {
1374 public:
1375 explicit basic_string_enumerator(const basic_string & chars) : chars_(chars) {}
1376
1377 const value_type & current() const override {return chars_[index_];}
1378
1379 bool move_next() override {return ++index_ < chars_.size();}
1380
1381 void reset() override {index_ = basic_string::npos;}
1382
1383 protected:
1384 const basic_string& chars_;
1385 xtd::size index_ = basic_string::npos;
1386 };
1387 return {new_ptr<basic_string_enumerator>(*this)};
1388 }
1389
1393 xtd::size index_of(const basic_string & value) const noexcept {return index_of(value, 0, size());}
1398 xtd::size index_of(const basic_string & value, xtd::size start_index) const {return index_of(value, start_index, size() - start_index);}
1405 xtd::size index_of(const basic_string & value, xtd::size start_index, xtd::size count) const {
1407 auto result = find(value, start_index);
1408 return result > start_index + count ? npos : result;
1409 }
1410
1413 xtd::size index_of(value_type value) const noexcept {return index_of(value, 0, size());}
1418 xtd::size index_of(value_type value, xtd::size start_index) const {return index_of(value, start_index, size() - start_index);}
1427 auto result = find(value, start_index);
1428 return result > start_index + count ? npos : result;
1429 }
1430
1434 xtd::size index_of_any(const xtd::array<value_type>& values) const noexcept;
1440 xtd::size index_of_any(const xtd::array<value_type>& values, xtd::size start_index) const;
1449 xtd::size index_of_any(const std::initializer_list<value_type>& values) const noexcept;
1450 xtd::size index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index) const;
1451 xtd::size index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index, xtd::size count) const;
1453
1460 basic_string insert(xtd::size start_index, const basic_string & value) const {
1462 auto result = *this;
1463 result.chars_.insert(start_index, value);
1464 return result;
1465 }
1466
1470 [[deprecated("Replaced by xtd::basic_string::is_empty(const xtd::basic_string&) - Will be removed in version 0.4.0.")]]
1471 bool is_empty() const noexcept {return is_empty(*this);}
1472
1476 xtd::size last_index_of(const basic_string & value) const noexcept {return last_index_of(value, 0, size());}
1482 xtd::size last_index_of(const basic_string & value, xtd::size start_index) const {return last_index_of(value, start_index, size() - start_index);}
1489 xtd::size last_index_of(const basic_string & value, xtd::size start_index, xtd::size count) const {
1491 auto result = rfind(value, start_index + count - value.size());
1492 return result < start_index ? npos : result;
1493 }
1494
1497 xtd::size last_index_of(value_type value) const noexcept {return last_index_of(value, 0, size());}
1503 xtd::size last_index_of(value_type value, xtd::size start_index) const {return last_index_of(value, start_index, size() - start_index);}
1513 auto result = rfind(value, start_index + count - 1);
1514 return result < start_index ? npos : result;
1515 }
1516
1533 xtd::size last_index_of_any(const std::initializer_list<value_type>& values) const noexcept;
1534 xtd::size last_index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index) const;
1535 xtd::size last_index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index, xtd::size count) const;
1537
1543 basic_string pad_left(xtd::size total_width) const noexcept {return pad_left(total_width, ' ');}
1550 basic_string pad_left(xtd::size total_width, char32 padding_char) const noexcept {return total_width < size() ? *this : basic_string(total_width - size(), padding_char) + *this;}
1551
1557 basic_string pad_right(xtd::size total_width) const noexcept {return pad_right(total_width, ' ');}
1564 basic_string pad_right(xtd::size total_width, char32 padding_char) const noexcept {return total_width < size() ? *this : *this + basic_string(total_width - size(), padding_char);}
1565
1570 basic_string quoted() const {return quoted('"', '\\');}
1575 basic_string quoted(value_type delimiter) const {return quoted(delimiter, '\\');}
1582 std::wstringstream ss;
1583 if constexpr(std::is_same_v<xtd::wchar, value_type>) ss << std::quoted(chars_, delimiter, escape);
1584 else ss << std::quoted(__xtd_convert_to_string<xtd::wchar>(chars_), static_cast<xtd::wchar>(delimiter), static_cast<xtd::wchar>(escape));
1585 return ss.str();
1586 }
1587
1591 basic_string remove(xtd::size start_index) const {return remove(start_index, size() - start_index);}
1598 auto result = *this;
1599 result.chars_.erase(start_index, count);
1600 return result;
1601 }
1602
1607 basic_string replace(value_type old_char, value_type new_char) const noexcept {return replace(string(1, old_char), string(1, new_char));}
1613 basic_string replace(const basic_string & old_string, const basic_string & new_string) const noexcept {
1614 auto result = *this;
1615 auto old_size = old_string.size();
1616 auto new_size = new_string.size();
1617 auto index = xtd::size {0};
1618 while (true) {
1619 index = result.find(old_string, index);
1620 if (index == npos) break;
1621 if (old_size == new_size) result.chars_.replace(index, old_size, new_string);
1622 else {
1623 result.chars_.erase(index, old_string.size());
1624 result.chars_.insert(index, new_string);
1625 }
1626 index += new_string.size();
1627 }
1628 return result;
1629 }
1630
1634 size_type rfind(const basic_string & str) const {return chars_.rfind(str);}
1640 size_type rfind(const basic_string & str, size_type pos) const {return chars_.rfind(str, pos);}
1648 size_type rfind(const_pointer s, size_type pos, size_type count) const {return chars_.rfind(s, pos, count);}
1654 size_type rfind(const_pointer s) const {return chars_.rfind(s);}
1661 size_type rfind(const_pointer s, size_type pos) const {return chars_.rfind(s, pos);}
1666 size_type rfind(value_type ch) const {return chars_.rfind(ch);}
1672 size_type rfind(value_type ch, size_type pos) const {return chars_.rfind(ch, pos);}
1673
1678 xtd::array<basic_string> split() const noexcept;
1684 xtd::array<basic_string> split(value_type separator) const noexcept;
1701 xtd::array<basic_string> split(value_type separator, xtd::string_split_options options) const noexcept;
1710 xtd::array<basic_string> split(value_type separator, xtd::size count) const noexcept;
1722 xtd::array<basic_string> split(value_type separator, xtd::size count, xtd::string_split_options options) const noexcept;
1728 xtd::array<basic_string> split(const xtd::array<value_type>& separators) const noexcept;
1745 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::string_split_options options) const noexcept;
1754 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::size count) const noexcept;
1766 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::size count, xtd::string_split_options options) const noexcept;
1767
1772 bool starts_with(value_type value) const noexcept {return starts_with(value, false);}
1778 bool starts_with(value_type value, bool ignore_case) const noexcept {
1779 if (ignore_case) return to_lower().find(static_cast<value_type>(tolower(value))) == 0;
1780 return find(value) == 0;
1781 }
1786 bool starts_with(const basic_string & value) const noexcept {return starts_with(value, string_comparison::ordinal);}
1792 bool starts_with(const basic_string & value, bool ignore_case) const noexcept {return starts_with(value, ignore_case ? string_comparison::ordinal_ignore_case : string_comparison::ordinal);}
1797 bool starts_with(const basic_string & value, xtd::string_comparison comparison_type) const noexcept {
1798 if (comparison_type == xtd::string_comparison::ordinal_ignore_case) return to_lower().find(value.to_lower()) == 0;
1799 return find(value) == 0;
1800 }
1801
1806 basic_string substr() const {return chars_.substr();}
1812 basic_string substr(size_type pos) const {
1814 return chars_.substr(pos);
1815 }
1822 basic_string substr(size_type pos, size_type count) const {
1824 return chars_.substr(pos, count);
1825 }
1826
1832 basic_string substring(xtd::size start_index) const {
1834 return substr(start_index);
1835 }
1841 basic_string substring(xtd::size start_index, xtd::size length) const {
1843 return substr(start_index, length);
1844 }
1845
1848 xtd::array<value_type> to_array() const noexcept;
1852 xtd::array<value_type> to_array(xtd::size start_index) const;
1857 xtd::array<value_type> to_array(xtd::size start_index, xtd::size length) const;
1858
1861 xtd::array<value_type> to_char_array() const noexcept;
1866 xtd::array<value_type> to_char_array(xtd::size start_index, xtd::size length) const;
1867
1870 basic_string to_lower() const noexcept {
1871 auto result = basic_string::empty_string;
1872 std::for_each(chars_.begin(), chars_.end(), [&](auto c) {result += static_cast<value_type>(std::tolower(c));});
1873 return result;
1874 }
1875
1879 basic_string<char> to_string() const noexcept override {
1880 if constexpr(std::is_same_v<char, char_t>) return chars_;
1881 else return __xtd_convert_to_string<char>(chars_);
1882 }
1883
1886 basic_string to_title_case() const noexcept;
1887
1890 basic_string<xtd::char16> to_u16string() const noexcept {
1891 if constexpr(std::is_same_v<xtd::char16, char_t>) return chars_;
1892 else return __xtd_convert_to_string<xtd::char16>(chars_);
1893 }
1894
1897 basic_string<xtd::char32> to_u32string() const noexcept {
1898 if constexpr(std::is_same_v<xtd::char32, char_t>) return chars_;
1899 else return __xtd_convert_to_string<xtd::char32>(chars_);
1900 }
1901
1904 basic_string<xtd::char8> to_u8string() const noexcept {
1905 if constexpr(std::is_same_v<xtd::char8, char_t>) return chars_;
1906 else return __xtd_convert_to_string<xtd::char8>(chars_);
1907 }
1908
1911 basic_string to_upper() const noexcept {
1912 auto result = basic_string::empty_string;
1913 std::for_each(chars_.begin(), chars_.end(), [&](auto c) {result += static_cast<value_type>(std::toupper(c));});
1914 return result;
1915 }
1916
1919 basic_string<xtd::wchar> to_wstring() const noexcept {
1920 if constexpr(std::is_same_v<xtd::wchar, char_t>) return chars_;
1921 else return __xtd_convert_to_string<xtd::wchar>(chars_);
1922 }
1923
1928 basic_string trim() const noexcept {return trim(default_trim_chars);}
1933 basic_string trim(value_type trim_char) const noexcept;
1938 basic_string trim(const xtd::array<value_type>& trim_chars) const noexcept;
1939
1944 basic_string trim_end() const noexcept {return trim_end(default_trim_chars);}
1949 basic_string trim_end(value_type trim_char) const noexcept;
1954 basic_string trim_end(const xtd::array<value_type>& trim_chars) const noexcept;
1955
1960 basic_string trim_start() const noexcept {return trim_start(default_trim_chars);}
1965 basic_string trim_start(value_type trim_char) const noexcept;
1970 basic_string trim_start(const xtd::array<value_type>& trim_chars) const noexcept;
1972
1974
1980 template<class object_t>
1981 [[deprecated("Replaced by typeof_<object_t>().name() - Will be removed in version 0.4.0.")]]
1982 static basic_string class_name() {return get_class_name(full_class_name<object_t>());}
1987 template<class object_t>
1988 [[deprecated("Replaced by typeof_(object).name() - Will be removed in version 0.4.0.")]]
1989 static basic_string class_name(const object_t& object) {return get_class_name(full_class_name(object));}
1994 [[deprecated("Replaced by typeof_(info).name() - Will be removed in version 0.4.0.")]]
1995 static basic_string class_name(const std::type_info & info) {return __xtd_get_class_name(info);}
1996
2006 static int32 compare(const basic_string & str_a, const basic_string & str_b) noexcept {return compare(str_a, str_b, false);}
2017 static int32 compare(const basic_string & str_a, const basic_string & str_b, bool ignore_case) noexcept {return compare(str_a, str_b, ignore_case ? xtd::string_comparison::ordinal_ignore_case : xtd::string_comparison::ordinal);}
2028 static int32 compare(const basic_string & str_a, const basic_string & str_b, xtd::string_comparison comparison_type) noexcept {return comparison_type == xtd::string_comparison::ordinal_ignore_case ? str_a.to_lower().compare(str_b.to_lower()) : str_a.compare(str_b);}
2041 static int32 compare(const basic_string & str_a, xtd::size index_a, const basic_string & str_b, xtd::size index_b, xtd::size length) {return compare(str_a, index_a, str_b, index_b, length, false);}
2055 static int32 compare(const basic_string & str_a, xtd::size index_a, const basic_string & str_b, xtd::size index_b, xtd::size length, bool ignore_case) {return compare(str_a, index_a, str_b, index_b, length, ignore_case ? xtd::string_comparison::ordinal_ignore_case : xtd::string_comparison::ordinal);}
2069 static int32 compare(const basic_string & str_a, xtd::size index_a, const basic_string & str_b, xtd::size index_b, xtd::size length, xtd::string_comparison comparison_type) {return comparison_type == xtd::string_comparison::ordinal_ignore_case ? str_a.substr(index_a, length).to_lower().compare(str_b.substr(index_b, length).to_lower()) : str_a.substr(index_a, length).compare(str_b.substr(index_b, length));}
2070
2077 static basic_string concat(const basic_string & str_a, const basic_string & str_b, const basic_string & str_c, const basic_string & str_d) noexcept {return str_a + str_b + str_c + str_d;}
2084 template<class object_a_t, class object_b_t, class object_c_t, class object_d_t>
2085 static basic_string concat(object_a_t obj_a, object_b_t obj_b, object_c_t obj_c, object_d_t obj_d) noexcept {return format("{}{}{}{}", obj_a, obj_b, obj_c, obj_d);}
2091 static basic_string concat(const basic_string & str_a, const basic_string & str_b, const basic_string & str_c) noexcept {return str_a + str_b + str_c;}
2097 template<class object_a_t, class object_b_t, class object_c_t>
2098 static basic_string concat(object_a_t obj_a, object_b_t obj_b, object_c_t obj_c) noexcept {return format("{}{}{}", obj_a, obj_b, obj_c);}
2103 static basic_string concat(const basic_string & str_a, const basic_string & str_b) noexcept {return str_a + str_b;}
2108 template<class object_a_t, class object_b_t>
2109 static basic_string concat(object_a_t obj_a, object_b_t obj_b) noexcept {return format("{}{}", obj_a, obj_b);}
2113 static basic_string concat(const xtd::array<basic_string>& values) noexcept;
2115 static basic_string concat(const xtd::array<const_pointer>& values) noexcept;
2116 template<class other_char_t>
2117 static basic_string concat(const xtd::array<const other_char_t*>& values) noexcept;
2118 static basic_string concat(const std::initializer_list<basic_string>& values) noexcept {
2119 auto result = basic_string::empty_string;
2120 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2121 return result;
2122 }
2123 static basic_string concat(const std::initializer_list<const_pointer>& values) noexcept {
2124 auto result = basic_string::empty_string;
2125 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2126 return result;
2127 }
2128 template<class other_char_t>
2129 static basic_string concat(const std::initializer_list<const other_char_t*>& values) noexcept {
2130 auto result = basic_string::empty_string;
2131 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2132 return result;
2133 }
2138 template<class object_t>
2139 static basic_string concat(const xtd::array<object_t>& args) noexcept;
2141 template<class object_t>
2142 static basic_string concat(const std::initializer_list<object_t>& args) noexcept {
2143 basic_string result;
2144 for (const auto& arg : args)
2145 result += format("{}", arg);
2146 return result;
2147 }
2152 template<class value_t>
2153 static basic_string concat(value_t value) noexcept {
2154 return format("{}", value);
2155 }
2156
2177 static basic_string demangle(const basic_string & name) {
2178 if constexpr(std::is_same_v<char, char_t>) return __xtd_demangle(name.chars());
2179 else return __xtd_demangle(__xtd_convert_to_string<char>(name.chars()));
2180 }
2181
2187 static bool equals(const basic_string & a, const basic_string & b) noexcept{return a.equals(b);}
2193 template<class char_a_t, class char_b_t>
2194 static bool equals(const char_a_t* a, const char_b_t* b) noexcept{return basic_string {a}.equals(basic_string {b});}
2195
2202 static bool equals(const basic_string & a, const basic_string & b, bool ignore_case) noexcept {return a.equals(b, ignore_case);}
2209 template<class char_a_t, class char_b_t>
2210 static bool equals(const char_a_t* a, const char_b_t* b, bool ignore_case) noexcept{return basic_string {a}.equals(basic_string {b}, ignore_case);}
2211
2218 template<class ...args_t>
2219 static basic_string format(const basic_string<char>& fmt, args_t&& ... args);
2220
2225 template<class object_t>
2226 [[deprecated("Replaced by typeof_<object_t>().full_name() - Will be removed in version 0.4.0.")]]
2227 static basic_string full_class_name() {return demangle(typeid(object_t).name());}
2232 template<class object_t>
2233 [[deprecated("Replaced by typeof_(object).full_name() - Will be removed in version 0.4.0.")]]
2234 static basic_string full_class_name(const object_t& object) {return demangle(typeid(object).name());}
2239 [[deprecated("Replaced by typeof_(info).full_name() - Will be removed in version 0.4.0.")]]
2240 static basic_string full_class_name(const std::type_info & info) {return __xtd_get_full_class_name(info);}
2241
2245 static bool is_empty(const xtd::basic_string<value_type, traits_type, allocator_type>& string) noexcept {return !string.length();}
2246
2253 template<class collection_t>
2254 static basic_string join(const basic_string separator, const collection_t& values) noexcept {
2255 xtd::size i = 0;
2256 basic_string result;
2257 for (const auto& item : values)
2258 result += format("{}{}", (i++ != 0 ? separator : basic_string {}), item);
2259 return result;
2260 }
2268 template<class collection_t>
2269 static basic_string join(const basic_string & separator, const collection_t& values, xtd::size index) {return join(separator, values, index, values.size() - index);}
2278 template<class collection_t>
2279 static basic_string join(const basic_string & separator, const collection_t& values, xtd::size index, xtd::size count) {
2280 if (index > values.size() || index + count > values.size()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range);
2281 xtd::size i = 0;
2282 basic_string result;
2283 for (const auto& item : values) {
2284 if (i >= index) result += format("{}{}", (i != index ? separator : basic_string {}), item);
2285 if (++i >= index + count) break;
2286 }
2287 return result;
2288 }
2289
2291 template<class value_t>
2292 static basic_string join(const basic_string & separator, const std::initializer_list<value_t>& values) noexcept;
2293 template<class value_t>
2294 static basic_string join(const basic_string & separator, const std::initializer_list<value_t>& values, xtd::size index);
2295 template<class value_t>
2296 static basic_string join(const basic_string & separator, const std::initializer_list<value_t>& values, xtd::size index, xtd::size count);
2298
2302 template<class value_t>
2303 static value_t parse(const basic_string & str) {
2304 if constexpr(std::is_same_v<char, char_t>) return xtd::parse<value_t>(str.chars());
2305 else return xtd::parse<value_t>(__xtd_convert_to_string<char>(str.chars()));
2306 }
2307
2367 template<class ...args_t>
2368 static basic_string sprintf(const basic_string & fmt, args_t&& ... args) noexcept {return __sprintf(fmt.c_str(), convert_param(std::forward<args_t>(args)) ...);}
2369
2374 template<class value_t>
2375 static bool try_parse(const basic_string & str, value_t& value) noexcept {
2376 try {
2377 value = parse<value_t>(str);
2378 return true;
2379 } catch (...) {
2380 return false;
2381 }
2382 }
2384
2386
2392 const_reference operator [](xtd::size index) const {
2394 return chars_[index];
2395 }
2396
2399 operator const base_type & () const noexcept {return chars_;}
2400
2404 basic_string& operator =(const basic_string<char>& str) noexcept {
2405 if constexpr(std::is_same<char_t, char>::value) chars_ = str.chars_;
2406 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2407 return *this;
2408 }
2412 basic_string& operator =(const basic_string<xtd::char16>& str) noexcept {
2413 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str.chars_;
2414 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2415 return *this;
2416 }
2420 basic_string& operator =(const basic_string<xtd::char32>& str) noexcept {
2421 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str.chars_;
2422 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2423 return *this;
2424 }
2428 basic_string& operator =(const basic_string<xtd::char8>& str) noexcept {
2429 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str.chars_;
2430 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2431 return *this;
2432 }
2436 basic_string& operator =(const basic_string<xtd::wchar>& str) noexcept {
2437 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str.chars_;
2438 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2439 return *this;
2440 }
2441
2445 basic_string& operator =(basic_string<char>&& str) noexcept {
2446 if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str.chars_);
2447 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2448 return *this;
2449 }
2453 basic_string& operator =(basic_string<xtd::char16>&& str) noexcept {
2454 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str.chars_);
2455 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2456 return *this;
2457 }
2461 basic_string& operator =(basic_string<xtd::char32>&& str) noexcept {
2462 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str.chars_);
2463 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2464 return *this;
2465 }
2469 basic_string& operator =(basic_string<xtd::char8>&& str) noexcept {
2470 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str.chars_);
2471 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2472 return *this;
2473 }
2477 basic_string& operator =(basic_string<xtd::wchar>&& str) noexcept {
2478 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str.chars_);
2479 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2480 return *this;
2481 }
2482
2486 basic_string& operator =(const std::basic_string<char>& str) noexcept {
2487 if constexpr(std::is_same<char_t, char>::value) chars_ = str;
2488 else chars_ = __xtd_convert_to_string<value_type>(str);
2489 return *this;
2490 }
2494 basic_string& operator =(const std::basic_string<xtd::char16>& str) noexcept {
2495 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str;
2496 else chars_ = __xtd_convert_to_string<value_type>(str);
2497 return *this;
2498 }
2502 basic_string& operator =(const std::basic_string<xtd::char32>& str) noexcept {
2503 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str;
2504 else chars_ = __xtd_convert_to_string<value_type>(str);
2505 return *this;
2506 }
2510 basic_string& operator =(const std::basic_string<xtd::char8>& str) noexcept {
2511 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str;
2512 else chars_ = __xtd_convert_to_string<value_type>(str);
2513 return *this;
2514 }
2518 basic_string& operator =(const std::basic_string<xtd::wchar>& str) noexcept {
2519 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str;
2520 else chars_ = __xtd_convert_to_string<value_type>(str);
2521 return *this;
2522 }
2523
2527 basic_string& operator =(std::basic_string<char>&& str) noexcept {
2528 if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str);
2529 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2530 return *this;
2531 }
2535 basic_string& operator =(std::basic_string<xtd::char16>&& str) noexcept {
2536 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str);
2537 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2538 return *this;
2539 }
2543 basic_string& operator =(std::basic_string<xtd::char32>&& str) noexcept {
2544 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str);
2545 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2546 return *this;
2547 }
2551 basic_string& operator =(std::basic_string<xtd::char8>&& str) noexcept {
2552 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str);
2553 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2554 return *this;
2555 }
2559 basic_string& operator =(std::basic_string<xtd::wchar>&& str) noexcept {
2560 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str);
2561 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2562 return *this;
2563 }
2564
2569 basic_string& operator =(const char* str) {
2571 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str);
2572 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str));
2573 return *this;
2574 }
2579 basic_string& operator =(const xtd::char16 * str) {
2581 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str);
2582 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str));
2583 return *this;
2584 }
2589 basic_string& operator =(const xtd::char32 * str) {
2591 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str);
2592 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str));
2593 return *this;
2594 }
2599 basic_string& operator =(const xtd::char8 * str) {
2601 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str);
2602 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str));
2603 return *this;
2604 }
2609 basic_string& operator =(const xtd::wchar * str) {
2611 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
2612 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
2613 return *this;
2614 }
2615
2619 basic_string& operator =(char character) {
2620 *this = basic_string(1, character);
2621 return *this;
2622 }
2626 basic_string& operator =(xtd::char16 character) {
2627 *this = basic_string(1, character);
2628 return *this;
2629 }
2633 basic_string& operator =(xtd::char32 character) {
2634 *this = basic_string(1, character);
2635 return *this;
2636 }
2640 basic_string& operator =(xtd::char8 character) {
2641 *this = basic_string(1, character);
2642 return *this;
2643 }
2647 basic_string& operator =(xtd::wchar character) {
2648 *this = basic_string(1, character);
2649 return *this;
2650 }
2651
2655 basic_string& operator =(const std::initializer_list<char>& il) {
2656 *this = basic_string(il);
2657 return *this;
2658 }
2662 basic_string& operator =(const std::initializer_list<xtd::char16>& il) {
2663 *this = basic_string(il);
2664 return *this;
2665 }
2669 basic_string& operator =(const std::initializer_list<xtd::char32>& il) {
2670 *this = basic_string(il);
2671 return *this;
2672 }
2676 basic_string& operator =(const std::initializer_list<xtd::char8>& il) {
2677 *this = basic_string(il);
2678 return *this;
2679 }
2683 basic_string& operator =(const std::initializer_list<xtd::wchar>& il) {
2684 *this = basic_string(il);
2685 return *this;
2686 }
2687
2691 basic_string & operator +=(const basic_string<char>& str) {
2692 if constexpr(std::is_same_v<char, char_t>) chars_ += str.chars_;
2693 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2694 return *this;
2695 }
2699 basic_string & operator +=(const basic_string<xtd::char16>& str) {
2700 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += str.chars_;
2701 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2702 return *this;
2703 }
2707 basic_string & operator +=(const basic_string<xtd::char32>& str) {
2708 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += str.chars_;
2709 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2710 return *this;
2711 }
2715 basic_string & operator +=(const basic_string<xtd::char8>& str) {
2716 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += str.chars_;
2717 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2718 return *this;
2719 }
2723 basic_string & operator +=(const basic_string<xtd::wchar>& str) {
2724 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += str.chars_;
2725 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2726 return *this;
2727 }
2728
2732 basic_string & operator +=(basic_string<char>&& str) {
2733 if constexpr(std::is_same_v<char, char_t>) chars_ += std::move(str.chars_);
2734 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2735 return *this;
2736 }
2740 basic_string & operator +=(basic_string<xtd::char16>&& str) {
2741 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += std::move(str.chars_);
2742 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2743 return *this;
2744 }
2748 basic_string & operator +=(basic_string<xtd::char32>&& str) {
2749 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += std::move(str.chars_);
2750 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2751 return *this;
2752 }
2756 basic_string & operator +=(basic_string<xtd::char8>&& str) {
2757 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += std::move(str.chars_);
2758 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2759 return *this;
2760 }
2764 basic_string & operator +=(basic_string<xtd::wchar>&& str) {
2765 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += std::move(str.chars_);
2766 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2767 return *this;
2768 }
2769
2773 basic_string & operator +=(const std::basic_string<char>& str) {
2774 if constexpr(std::is_same_v<char, char_t>) chars_ += str;
2775 else chars_ += __xtd_convert_to_string<value_type>(str);
2776 return *this;
2777 }
2781 basic_string & operator +=(const std::basic_string<xtd::char16>& str) {
2782 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += str;
2783 else chars_ += __xtd_convert_to_string<value_type>(str);
2784 return *this;
2785 }
2789 basic_string & operator +=(const std::basic_string<xtd::char32>& str) {
2790 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += str;
2791 else chars_ += __xtd_convert_to_string<value_type>(str);
2792 return *this;
2793 }
2797 basic_string & operator +=(const std::basic_string<xtd::char8>& str) {
2798 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += str;
2799 else chars_ += __xtd_convert_to_string<value_type>(str);
2800 return *this;
2801 }
2805 basic_string & operator +=(const std::basic_string<xtd::wchar>& str) {
2806 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += str;
2807 else chars_ += __xtd_convert_to_string<value_type>(str);
2808 return *this;
2809 }
2810
2814 basic_string & operator +=(const char* str) {
2815 chars_ += basic_string(str).chars_;
2816 return *this;
2817 }
2821 basic_string & operator +=(const xtd::char16 * str) {
2822 chars_.append(basic_string(str).chars_); return *this;
2823 }
2827 basic_string & operator +=(const xtd::char32 * str) {
2828 chars_ += basic_string(str).chars_;
2829 return *this;
2830 }
2834 basic_string & operator +=(const xtd::char8 * str) {
2835 chars_ += basic_string(str).chars_;
2836 return *this;
2837 }
2841 basic_string & operator +=(const xtd::wchar * str) {
2842 chars_ += basic_string(str).chars_;
2843 return *this;
2844 }
2848 basic_string & operator +=(char ch) {
2849 chars_ += basic_string(1, ch).chars_;
2850 return *this;
2851 }
2855 basic_string & operator +=(xtd::char16 ch) {
2856 chars_ += basic_string(1, ch).chars_;
2857 return *this;
2858 }
2862 basic_string & operator +=(xtd::char32 ch) {
2863 chars_ += basic_string(1, ch).chars_;
2864 return *this;
2865 }
2869 basic_string & operator +=(xtd::char8 ch) {
2870 chars_ += basic_string(1, ch).chars_;
2871 return *this;
2872 }
2876 basic_string & operator +=(xtd::wchar ch) {
2877 chars_ += basic_string(1, ch).chars_;
2878 return *this;
2879 }
2880
2885 friend basic_string operator +(const basic_string & lhs, const basic_string<char>& rhs) {
2886 auto result = lhs;
2887 result += rhs;
2888 return result;
2889 }
2894 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char16>& rhs) {
2895 auto result = lhs;
2896 result += rhs;
2897 return result;
2898 }
2903 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char32>& rhs) {
2904 auto result = lhs;
2905 result += rhs;
2906 return result;
2907 }
2912 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char8>& rhs) {
2913 auto result = lhs;
2914 result += rhs;
2915 return result;
2916 }
2921 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::wchar>& rhs) {
2922 auto result = lhs;
2923 result += rhs;
2924 return result;
2925 }
2926
2931 friend basic_string operator +(basic_string&& lhs, basic_string<char>&& rhs) {
2932 auto result = std::move(lhs);
2933 result += std::move(rhs);
2934 return result;
2935 }
2940 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char16>&& rhs) {
2941 auto result = std::move(lhs);
2942 result += std::move(rhs);
2943 return result;
2944 }
2949 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char32>&& rhs) {
2950 auto result = std::move(lhs);
2951 result += std::move(rhs);
2952 return result;
2953 }
2958 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char8>&& rhs) {
2959 auto result = std::move(lhs);
2960 result += std::move(rhs);
2961 return result;
2962 }
2967 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::wchar>&& rhs) {
2968 auto result = std::move(lhs);
2969 result += std::move(rhs);
2970 return result;
2971 }
2972
2977 friend basic_string operator +(basic_string&& lhs, const basic_string<char>& rhs) {
2978 auto result = std::move(lhs);
2979 result += rhs;
2980 return result;
2981 }
2986 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char16>& rhs) {
2987 auto result = std::move(lhs);
2988 result += rhs;
2989 return result;
2990 }
2995 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char32>& rhs) {
2996 auto result = std::move(lhs);
2997 result += rhs;
2998 return result;
2999 }
3004 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char8>& rhs) {
3005 auto result = std::move(lhs);
3006 result += rhs;
3007 return result;
3008 }
3013 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::wchar>& rhs) {
3014 auto result = std::move(lhs);
3015 result += rhs;
3016 return result;
3017 }
3018
3023 friend basic_string operator +(const basic_string & lhs, basic_string<char>&& rhs) {
3024 auto result = lhs;
3025 result += std::move(rhs);
3026 return result;
3027 }
3032 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char16>&& rhs) {
3033 auto result = lhs;
3034 result += std::move(rhs);
3035 return result;
3036 }
3041 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char32>&& rhs) {
3042 auto result = lhs;
3043 result += std::move(rhs);
3044 return result;
3045 }
3050 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char8>&& rhs) {
3051 auto result = lhs;
3052 result += std::move(rhs);
3053 return result;
3054 }
3059 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::wchar>&& rhs) {
3060 auto result = lhs;
3061 result += std::move(rhs);
3062 return result;
3063 }
3064
3069 friend basic_string operator +(const basic_string & lhs, const std::basic_string<char>& rhs) {
3070 auto result = lhs;
3071 result += rhs;
3072 return result;
3073 }
3078 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char16>& rhs) {
3079 auto result = lhs;
3080 result += rhs;
3081 return result;
3082 }
3087 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char32>& rhs) {
3088 auto result = lhs;
3089 result += rhs;
3090 return result;
3091 }
3096 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char8>& rhs) {
3097 auto result = lhs;
3098 result += rhs;
3099 return result;
3100 }
3105 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::wchar>& rhs) {
3106 auto result = lhs;
3107 result += rhs;
3108 return result;
3109 }
3110
3115 friend basic_string operator +(const std::basic_string<char>& lhs, const basic_string & rhs) {
3116 auto result = lhs;
3117 if constexpr(std::is_same_v<char, char_t>) result += rhs.chars();
3118 else result += __xtd_convert_to_string<char>(rhs.chars());
3119 return result;
3120 }
3125 friend basic_string operator +(const std::basic_string<xtd::char16>& lhs, const basic_string & rhs) {
3126 auto result = lhs;
3127 if constexpr(std::is_same_v<xtd::char16, char_t>) result += rhs.chars();
3128 else result += __xtd_convert_to_string<xtd::char16>(rhs.chars());
3129 return result;
3130 }
3135 friend basic_string operator +(const std::basic_string<xtd::char32>& lhs, const basic_string & rhs) {
3136 auto result = lhs;
3137 if constexpr(std::is_same_v<xtd::char32, char_t>) result += rhs.chars();
3138 else result += __xtd_convert_to_string<xtd::char32>(rhs.chars());
3139 return result;
3140 }
3145 friend basic_string operator +(const std::basic_string<xtd::char8>& lhs, const basic_string & rhs) {
3146 auto result = lhs;
3147 if constexpr(std::is_same_v<xtd::char8, char_t>) result += rhs.chars();
3148 else result += __xtd_convert_to_string<xtd::char8>(rhs.chars());
3149 return result;
3150 }
3155 friend basic_string operator +(const std::basic_string<xtd::wchar>& lhs, const basic_string & rhs) {
3156 auto result = lhs;
3157 if constexpr(std::is_same_v<xtd::wchar, char_t>) result += rhs.chars();
3158 else result += __xtd_convert_to_string<xtd::wchar>(rhs.chars());
3159 return result;
3160 }
3161
3166 friend basic_string operator +(const basic_string & lhs, const char* rhs) {
3167 auto result = lhs;
3168 result += rhs;
3169 return result;
3170 }
3175 friend basic_string operator +(const basic_string & lhs, const xtd::char16 * rhs) {
3176 auto result = lhs;
3177 result += rhs;
3178 return result;
3179 }
3184 friend basic_string operator +(const basic_string & lhs, const xtd::char32 * rhs) {
3185 auto result = lhs;
3186 result += rhs;
3187 return result;
3188 }
3193 friend basic_string operator +(const basic_string & lhs, const xtd::char8 * rhs) {
3194 auto result = lhs;
3195 result += rhs;
3196 return result;
3197 }
3202 friend basic_string operator +(const basic_string & lhs, const xtd::wchar * rhs) {
3203 auto result = lhs;
3204 result += rhs;
3205 return result;
3206 }
3207
3212 friend basic_string operator +(basic_string&& lhs, const char* rhs) {
3213 auto result = std::move(lhs);
3214 result += rhs;
3215 return result;
3216 }
3221 friend basic_string operator +(basic_string&& lhs, const xtd::char16 * rhs) {
3222 auto result = std::move(lhs);
3223 result += rhs;
3224 return result;
3225 }
3230 friend basic_string operator +(basic_string&& lhs, const xtd::char32 * rhs) {
3231 auto result = std::move(lhs);
3232 result += rhs;
3233 return result;
3234 }
3239 friend basic_string operator +(basic_string&& lhs, const xtd::char8 * rhs) {
3240 auto result = std::move(lhs);
3241 result += rhs;
3242 return result;
3243 }
3248 friend basic_string operator +(basic_string&& lhs, const xtd::wchar * rhs) {
3249 auto result = std::move(lhs);
3250 result += rhs;
3251 return result;
3252 }
3253
3258 friend basic_string operator +(const char* lhs, const basic_string & rhs) {
3259 auto result = basic_string(lhs);
3260 result += rhs;
3261 return result;
3262 }
3267 friend basic_string operator +(const xtd::char16 * lhs, const basic_string & rhs) {
3268 auto result = basic_string(lhs);
3269 result += rhs;
3270 return result;
3271 }
3276 friend basic_string operator +(const xtd::char32 * lhs, const basic_string & rhs) {
3277 auto result = basic_string(lhs);
3278 result += rhs;
3279 return result;
3280 }
3285 friend basic_string operator +(const xtd::char8 * lhs, const basic_string & rhs) {
3286 auto result = basic_string(lhs);
3287 result += rhs;
3288 return result;
3289 }
3294 friend basic_string operator +(const xtd::wchar * lhs, const basic_string & rhs) {
3295 auto result = basic_string(lhs);
3296 result += rhs;
3297 return result;
3298 }
3299
3304 friend basic_string operator +(const char* lhs, basic_string&& rhs) {
3305 auto result = basic_string(lhs);
3306 result += std::move(rhs);
3307 return result;
3308 }
3313 friend basic_string operator +(const xtd::char16 * lhs, basic_string&& rhs) {
3314 auto result = basic_string(lhs);
3315 result += std::move(rhs);
3316 return result;
3317 }
3322 friend basic_string operator +(const xtd::char32 * lhs, basic_string&& rhs) {
3323 auto result = basic_string(lhs);
3324 result += std::move(rhs);
3325 return result;
3326 }
3331 friend basic_string operator +(const xtd::char8 * lhs, basic_string&& rhs) {
3332 auto result = basic_string(lhs);
3333 result += std::move(rhs);
3334 return result;
3335 }
3340 friend basic_string operator +(const xtd::wchar * lhs, basic_string&& rhs) {
3341 auto result = basic_string(lhs);
3342 result += std::move(rhs);
3343 return result;
3344 }
3345
3350 friend basic_string operator +(const basic_string & lhs, const char rhs) {
3351 auto result = lhs;
3352 result += rhs;
3353 return result;
3354 }
3359 friend basic_string operator +(const basic_string & lhs, const xtd::char16 rhs) {
3360 auto result = lhs;
3361 result += rhs;
3362 return result;
3363 }
3368 friend basic_string operator +(const basic_string & lhs, const xtd::char32 rhs) {
3369 auto result = lhs;
3370 result += rhs;
3371 return result;
3372 }
3377 friend basic_string operator +(const basic_string & lhs, const xtd::char8 rhs) {
3378 auto result = lhs;
3379 result += rhs;
3380 return result;
3381 }
3386 friend basic_string operator +(const basic_string & lhs, const xtd::wchar rhs) {
3387 auto result = lhs;
3388 result += rhs;
3389 return result;
3390 }
3391
3396 friend basic_string operator +(basic_string&& lhs, const char rhs) {
3397 auto result = std::move(lhs);
3398 result += rhs;
3399 return result;
3400 }
3405 friend basic_string operator +(basic_string&& lhs, const xtd::char16 rhs) {
3406 auto result = std::move(lhs);
3407 result += rhs;
3408 return result;
3409 }
3414 friend basic_string operator +(basic_string&& lhs, const xtd::char32 rhs) {
3415 auto result = std::move(lhs);
3416 result += rhs;
3417 return result;
3418 }
3423 friend basic_string operator +(basic_string&& lhs, const xtd::char8 rhs) {
3424 auto result = std::move(lhs);
3425 result += rhs;
3426 return result;
3427 }
3432 friend basic_string operator +(basic_string&& lhs, const xtd::wchar rhs) {
3433 auto result = std::move(lhs);
3434 result += rhs;
3435 return result;
3436 }
3437
3442 friend basic_string operator +(char lhs, const basic_string & rhs) {
3443 auto result = basic_string(1, lhs);
3444 result += rhs;
3445 return result;
3446 }
3451 friend basic_string operator +(xtd::char16 lhs, const basic_string & rhs) {
3452 auto result = basic_string(1, lhs);
3453 result += rhs;
3454 return result;
3455 }
3460 friend basic_string operator +(xtd::char32 lhs, const basic_string & rhs) {
3461 auto result = basic_string(1, lhs);
3462 result += rhs;
3463 return result;
3464 }
3469 friend basic_string operator +(xtd::char8 lhs, const basic_string & rhs) {
3470 auto result = basic_string(1, lhs);
3471 result += rhs;
3472 return result;
3473 }
3478 friend basic_string operator +(xtd::wchar lhs, const basic_string & rhs) {
3479 auto result = basic_string(1, lhs);
3480 result += rhs;
3481 return result;
3482 }
3483
3488 friend basic_string operator +(char lhs, basic_string&& rhs) {
3489 auto result = basic_string(1, lhs);
3490 result += std::move(rhs);
3491 return result;
3492 }
3497 friend basic_string operator +(xtd::char16 lhs, basic_string&& rhs) {
3498 auto result = basic_string(1, lhs);
3499 result += std::move(rhs);
3500 return result;
3501 }
3506 friend basic_string operator +(xtd::char32 lhs, basic_string&& rhs) {
3507 auto result = basic_string(1, lhs);
3508 result += std::move(rhs);
3509 return result;
3510 }
3515 friend basic_string operator +(xtd::char8 lhs, basic_string&& rhs) {
3516 auto result = basic_string(1, lhs);
3517 result += std::move(rhs);
3518 return result;
3519 }
3524 friend basic_string operator +(xtd::wchar lhs, basic_string&& rhs) {
3525 auto result = basic_string(1, lhs);
3526 result += std::move(rhs);
3527 return result;
3528 }
3529
3538 //friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string& str) {return stream << str.to_string().chars_;}
3539 friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string & str) {
3540 if constexpr(std::is_same_v<char, char_t>) return stream << str.chars();
3541 else return stream << __xtd_convert_to_string<char>(str.chars());
3542 }
3549 friend std::basic_ostream<xtd::wchar>& operator <<(std::basic_ostream<xtd::wchar>& stream, const basic_string & str) {return stream << str.to_wstring().chars();}
3550
3559 friend std::basic_istream<char>& operator >>(std::basic_istream<char>& stream, basic_string & str) {
3560 auto s = std::basic_string<char> {};
3561 stream >> s;
3562 str = s;
3563 return stream;
3564 }
3573 friend std::basic_istream<xtd::wchar>& operator >>(std::basic_istream<xtd::wchar>& stream, basic_string & str) {
3574 auto s = std::basic_string<xtd::wchar> {};
3575 stream >> s;
3576 str = s;
3577 return stream;
3578 }
3580
3581 private:
3582 friend class basic_string<char>;
3583 friend class basic_string<xtd::char16>;
3584 friend class basic_string<xtd::char32>;
3585 friend class basic_string<xtd::char8>;
3586 friend class basic_string<xtd::wchar>;
3587
3588 static const xtd::array<value_type> default_split_separators;
3589 static const xtd::array<value_type> default_trim_chars;
3590
3591 template<class arg_t>
3592 static auto convert_param(arg_t&& arg) noexcept {
3593 if constexpr(std::is_same<std::remove_cv_t<std::remove_reference_t<arg_t>>, std::string>::value) return std::forward<arg_t>(arg).c_str();
3594 else if constexpr(std::is_same<std::remove_cv_t<std::remove_reference_t<arg_t>>, std::u16string>::value) return std::forward<arg_t>(arg).c_str();
3595 else if constexpr(std::is_same<std::remove_cv_t<std::remove_reference_t<arg_t>>, std::u32string>::value) return std::forward<arg_t>(arg).c_str();
3596 else if constexpr(std::is_same<std::remove_cv_t<std::remove_reference_t<arg_t>>, std::u8string>::value) return std::forward<arg_t>(arg).c_str();
3597 else if constexpr(std::is_same<std::remove_cv_t<std::remove_reference_t<arg_t>>, std::wstring>::value) return std::forward<arg_t>(arg).c_str();
3598 else if constexpr(std::is_same<std::remove_cv_t<std::remove_reference_t<arg_t>>, basic_string>::value) return std::forward<arg_t>(arg).c_str();
3599 else return std::forward<arg_t>(arg);
3600 }
3601
3602 static basic_string get_class_name(const basic_string & full_name) {
3603 auto length = full_name.last_index_of("<");
3604 if (length == npos) length = full_name.length();
3605 if (full_name.last_index_of("::", 0, length) == npos) return full_name;
3606 return full_name.substring(full_name.last_index_of("::", 0, length) + 2);
3607 }
3608
3609 typename base_type::iterator to_base_type_iterator(iterator value) const noexcept {
3610 if (value == begin()) return chars_.begin();
3611 if (value == end()) return chars_.end();
3612 return chars_.begin() + (value - begin());
3613 }
3614
3615 iterator to_iterator(typename base_type::iterator value) const noexcept {
3616 if (value == chars_.begin()) return begin();
3617 if (value == chars_.end()) return end();
3618 return begin() + (value - chars_.begin());
3619 }
3620
3621 base_type chars_;
3622 };
3623}
3624
3625#define __XTD_BASIC_STRING_INTERNAL__
3626#include "basic_string_.hpp"
3627#undef __XTD_BASIC_STRING_INTERNAL__
Contains xtd::array definitions.
Contains __format_information struct.
Contains __format method.
Contains string definitions.
Contains __xtd_std_version definitions.
Contains xtd::basic_string class.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:61
Represents text as a sequence of character units.
Definition basic_string.hpp:71
xtd::size index_of(value_type value) const noexcept
Reports the index of the first occurrence of the specified character in this basic_string.
Definition basic_string.hpp:1413
basic_string pad_left(xtd::size total_width) const noexcept
Right-aligns the characters in this basic_string, padding with spaces on the left for a specified tot...
Definition basic_string.hpp:1543
bool ends_with(const basic_string &value, xtd::string_comparison comparison_type) const noexcept
Determines whether the end of this basic_string matches the specified basic_string when compared usin...
Definition basic_string.hpp:1136
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.hpp:1334
allocator_type get_allocator() const
Returns the allocator associated with the string.
Definition basic_string.hpp:1362
xtd::size index_of(value_type value, xtd::size start_index, xtd::size count) const
Reports the index of the first occurrence of the specified character in this basic_string....
Definition basic_string.hpp:1425
xtd::size index_of(value_type value, xtd::size start_index) const
Reports the index of the first occurrence of the specified character in this basic_string....
Definition basic_string.hpp:1418
size_type find_first_of(const basic_string &str) const
Finds the first character equal to one of the characters in the given character sequence....
Definition basic_string.hpp:1188
xtd::size index_of_any(const xtd::array< value_type > &values, xtd::size start_index) const
Reports the index of the first occurrence in this instance of any character in a specified array of c...
size_type find_last_of(char_t ch, size_type pos) const
Finds the last character equal to one of characters in the given character sequence....
Definition basic_string.hpp:1314
bool ends_with(value_type value, bool ignore_case) const noexcept
Determines whether the end of this basic_string matches the specified character, ignoring or honoring...
Definition basic_string.hpp:1119
enumerator_type get_enumerator() const noexcept override
Returns an enumerator that iterates through a collection.
Definition basic_string.hpp:1372
size_type find_last_not_of(char_t ch, size_type pos) const
Finds the last character equal to none of the characters in the given character sequence....
Definition basic_string.hpp:1358
size_type rfind(const_pointer s) const
Finds the last substring that is equal to the given character sequence. The search begins at xtd::bas...
Definition basic_string.hpp:1654
virtual const base_type & get_base_type() const noexcept
Returns the underlying base type.
Definition basic_string.hpp:1366
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.hpp:1259
xtd::size last_index_of(const basic_string &value, xtd::size start_index) const
Reports the index of the last occurrence of the specified character in this basic_string....
Definition basic_string.hpp:1482
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.hpp:1296
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.hpp:1303
size_type find_first_not_of(const basic_string &str) const
Finds the first character equal to none of the characters in the given character sequence....
Definition basic_string.hpp:1232
virtual bool contains(const basic_string &value) const noexcept
Returns a value indicating whether a specified substring occurs within this basic_string.
Definition basic_string.hpp:1090
size_type find_first_of(const basic_string &str, size_type pos) const
Finds the first character equal to one of the characters in the given character sequence....
Definition basic_string.hpp:1194
basic_string insert(xtd::size start_index, const basic_string &value) const
Inserts a specified instance of basic_string at a specified index position in this instance.
Definition basic_string.hpp:1460
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.hpp:1215
int32 compare(size_type pos1, size_type count1, const_pointer s, size_type count2) const
Compares two character sequences.
Definition basic_string.hpp:1058
xtd::size last_index_of(const basic_string &value, xtd::size start_index, xtd::size count) const
Reports the index of the last occurrence of the specified character in this basic_string....
Definition basic_string.hpp:1489
xtd::size index_of_any(const xtd::array< value_type > &values) const noexcept
Reports the index of the first occurrence in this instance of any character in a specified array of c...
size_type find_first_not_of(char_t ch) const
Finds the first character equal to none of the characters in the given character sequence....
Definition basic_string.hpp:1264
int32 compare_to(const basic_string &value) const noexcept override
Compares this instance with a specified xtd::basic_string object and indicates whether this instance ...
Definition basic_string.hpp:1081
basic_string quoted() const
Allows insertion and extraction of quoted strings, such as the ones found in CSV or XML.
Definition basic_string.hpp:1570
size_type find(const_pointer s) const
Finds the first substring equal to the given character sequence. Search begins at 0,...
Definition basic_string.hpp:1164
basic_string remove(xtd::size start_index) const
Deletes all the characters from this basic_string beginning at a specified position and continuing th...
Definition basic_string.hpp:1591
size_type find_last_not_of(char_t ch) const
Finds the last character equal to none of the characters in the given character sequence....
Definition basic_string.hpp:1352
basic_string remove(xtd::size start_index, xtd::size count) const
Deletes all the characters from this basic_string beginning at a specified position and continuing th...
Definition basic_string.hpp:1596
xtd::size last_index_of(value_type value) const noexcept
Reports the index of the last occurrence of the specified character in this tring.
Definition basic_string.hpp:1497
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.hpp:1340
bool is_empty() const noexcept
Indicates whether this basic_string is an empty basic_string ("").
Definition basic_string.hpp:1471
size_type find(value_type ch) const
Finds the first substring equal to the given character sequence. Search begins at 0,...
Definition basic_string.hpp:1176
basic_string quoted(value_type delimiter) const
Allows insertion and extraction of quoted strings, such as the ones found in CSV or XML ith specified...
Definition basic_string.hpp:1575
int32 compare_to(const object &value) const
Compares this instance with a specified xtd::object and indicates whether this instance precedes,...
Definition basic_string.hpp:1069
basic_string pad_right(xtd::size total_width, char32 padding_char) const noexcept
Left-aligns the characters in this basic_string, padding with spaces on the right for a specified tot...
Definition basic_string.hpp:1564
basic_string replace(const basic_string &old_string, const basic_string &new_string) const noexcept
Replaces all occurrences of a specified basic_string in this basic_string with another specified basi...
Definition basic_string.hpp:1613
xtd::size get_hash_code() const noexcept override
Returns the hash code for this basic_string.
Definition basic_string.hpp:1370
virtual bool contains(value_type value) const noexcept
Returns a value indicating whether a specified char occurs within this basic_string.
Definition basic_string.hpp:1086
size_type find_last_not_of(const basic_string &str) const
Finds the last character equal to none of the characters in the given character sequence....
Definition basic_string.hpp:1320
size_type find_first_not_of(const basic_string &str, size_type pos) const
Finds the first character equal to none of the characters in the given character sequence....
Definition basic_string.hpp:1238
bool ends_with(value_type value) const noexcept
Determines whether the end of this basic_string matches the specified character.
Definition basic_string.hpp:1114
xtd::size last_index_of(value_type value, xtd::size start_index, xtd::size count) const
Reports the index of the last occurrence of the specified character in this basic_string....
Definition basic_string.hpp:1511
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.hpp:1202
xtd::size index_of(const basic_string &value, xtd::size start_index, xtd::size count) const
Reports the index of the first occurrence of the specified character in this basic_string....
Definition basic_string.hpp:1405
size_type find(const basic_string &str) const
Finds the first substring equal to the given character sequence. Search begins at 0,...
Definition basic_string.hpp:1144
xtd::size last_index_of_any(const xtd::array< value_type > &values) const noexcept
Reports the index of the last occurrence in this instance of any character in a specified array of ch...
xtd::size index_of(const basic_string &value) const noexcept
Reports the index of the first occurrence of the specified basic_string in this basic_string.
Definition basic_string.hpp:1393
size_type find_first_not_of(char_t ch, size_type pos) const
Finds the first character equal to none of the characters in the given character sequence....
Definition basic_string.hpp:1270
bool equals(const object &obj) const noexcept override
Determines whether this instance and a specified object, which must also be a xtd::basic_string objec...
Definition basic_string.hpp:1095
size_type find_first_of(char_t ch) const
Finds the first character equal to one of the characters in the given character sequence....
Definition basic_string.hpp:1220
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.hpp:1252
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.hpp:1246
basic_string replace(value_type old_char, value_type new_char) const noexcept
Replaces all occurrences of a specified char_t in this basic_string with another specified char_t.
Definition basic_string.hpp:1607
xtd::size index_of_any(const xtd::array< value_type > &values, xtd::size start_index, xtd::size count) const
Reports the index of the first occurrence in this instance of any character in a specified array of c...
bool ends_with(const basic_string &value, bool ignore_case) const noexcept
Determines whether the end of this basic_string instance matches the specified basic_string,...
Definition basic_string.hpp:1131
bool equals(const basic_string &value, bool ignore_case) const noexcept
Determines whether this instance and another specified xtd::basic_string object have the same value,...
Definition basic_string.hpp:1106
basic_string pad_right(xtd::size total_width) const noexcept
Left-aligns the characters in this basic_string, padding with spaces on the right for a specified tot...
Definition basic_string.hpp:1557
size_type find_last_of(const basic_string &str, size_type pos) const
Finds the last character equal to one of characters in the given character sequence....
Definition basic_string.hpp:1282
xtd::size last_index_of_any(const xtd::array< value_type > &values, xtd::size start_index, xtd::size count) const
Reports the index of the last occurrence in this instance of any character in a specified array of ch...
bool ends_with(const basic_string &value) const noexcept
Determines whether the end of this basic_string matches the specified basic_string.
Definition basic_string.hpp:1126
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.hpp:1208
xtd::size last_index_of(const basic_string &value) const noexcept
Reports the index of the last occurrence of the specified basic_string in this basic_string.
Definition basic_string.hpp:1476
basic_string pad_left(xtd::size total_width, char32 padding_char) const noexcept
Right-aligns the characters in this basic_string, padding with spaces on the left for a specified tot...
Definition basic_string.hpp:1550
bool equals(const basic_string &value) const noexcept override
Determines whether this instance and another specified xtd::basic_string object have the same value.
Definition basic_string.hpp:1100
size_type find_last_of(char_t ch) const
Finds the last character equal to one of characters in the given character sequence....
Definition basic_string.hpp:1308
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.hpp:1347
xtd::size last_index_of_any(const xtd::array< value_type > &values, xtd::size start_index) const
Reports the index of the last occurrence in this instance of any character in a specified array of ch...
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.hpp:1182
size_type find_last_of(const basic_string &str) const
Finds the last character equal to one of characters in the given character sequence....
Definition basic_string.hpp:1276
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.hpp:1290
size_type find_last_not_of(const basic_string &str, size_type pos) const
Finds the last character equal to none of the characters in the given character sequence....
Definition basic_string.hpp:1326
size_type find(const basic_string &str, size_type pos) const
Finds the first substring equal to the given character sequence. Search begins at pos,...
Definition basic_string.hpp:1150
xtd::size index_of(const basic_string &value, xtd::size start_index) const
Reports the index of the first occurrence of the specified character in this basic_string....
Definition basic_string.hpp:1398
size_type find_first_of(char_t ch, size_type pos) const
Finds the first character equal to one of the characters in the given character sequence....
Definition basic_string.hpp:1226
basic_string quoted(value_type delimiter, value_type escape) const
Allows insertion and extraction of quoted strings, such as the ones found in CSV or XML ith specified...
Definition basic_string.hpp:1581
xtd::size last_index_of(value_type value, xtd::size start_index) const
Reports the index of the last occurrence of the specified character in this basic_string....
Definition basic_string.hpp:1503
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.hpp:1158
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.hpp:1171
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.hpp:1661
virtual const_iterator cbegin() const
Returns an iterator to the first element of the enumerable.
Definition enumerable_iterators.hpp:148
virtual const_iterator begin() const
Returns an iterator to the first element of the enumerable.
Definition enumerable_iterators.hpp:141
virtual const_iterator cend() const
Returns an iterator to the element following the last element of the enumerable.
Definition enumerable_iterators.hpp:152
virtual const_iterator end() const
Returns an iterator to the element following the last element of the enumerable.
Definition enumerable_iterators.hpp:156
enumerable_iterator< xtd::collections::generic::ienumerable< char_t > > iterator
Definition enumerable_iterators.hpp:131
auto append(const source_t &element) const noexcept
Appends a value to the end of the sequence.
Definition enumerable.hpp:144
auto concat(const ienumerable< char_t > &second) const noexcept
Definition enumerable.hpp:185
Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Definition ienumerable.hpp:36
char_t value_type
Definition ienumerable.hpp:42
typename xtd::collections::generic::extensions::enumerable_iterators< char_t, xtd::collections::generic::ienumerable< char_t > >::const_iterator const_iterator
Definition ienumerable.hpp:46
typename xtd::collections::generic::extensions::enumerable_iterators< char_t, xtd::collections::generic::ienumerable< char_t > >::iterator iterator
Definition ienumerable.hpp:44
Supports a simple iteration over a generic collection.
Definition ienumerator.hpp:58
static xtd::size combine(args_t... values) noexcept
Combines values into a hash code.
Definition hash_code.hpp:70
static void throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current())
Throws an exption with specified exception case.
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.hpp:21
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
object()=default
Create a new instance of the ultimate base class object.
virtual xtd::string to_string() const noexcept
Returns a xtd::string that represents the current object.
Contains xtd::collections::generic::ienumerable <type_t> interface.
xtd::string format(const xtd::string &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
Definition format.hpp:20
xtd::string sprintf(const xtd::string &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to basic_string using the specified f...
Definition sprintf.hpp:73
@ argument
The argument is not valid.
Definition exception_case.hpp:31
@ index_out_of_range
The index is out of range.
Definition exception_case.hpp:59
@ 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:77
xtd::string name() noexcept
Gets the thread name of the current thread.
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
char8_t char8
Represents a 8-bit unicode character.
Definition char8.hpp:26
null_ptr null
Represents a null pointer value.
wchar_t wchar
Represents a wide character.
Definition wchar.hpp:24
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
char16_t char16
Represents a 16-bit unicode character.
Definition char16.hpp:26
char32_t char32
Represents a 32-bit unicode character.
Definition char32.hpp:23
string_comparison
Specifies the culture, case, and sort rules to be used by certain overloads of the xtd::string::compa...
Definition string_comparison.hpp:14
string_split_options
Specifies whether applicable xtd::string::split method overloads include or omit empty substrings fro...
Definition string_split_options.hpp:14
ptr< type_t > new_ptr(args_t &&... args)
The xtd::new_ptr operator creates a xtd::ptr object.
Definition new_ptr.hpp:24
value_t parse(const std::string &str)
Convert a string into a type.
Definition parse.hpp:34
bool try_parse(const std::basic_string< char > &str, value_t &value) noexcept
Convert a string into a type.
Definition parse.hpp:416
@ ordinal
Compare strings using ordinal (binary) sort rules.
Definition string_comparison.hpp:24
@ ordinal_ignore_case
Compare strings using ordinal (binary) sort rules and ignoring the case of the strings being compared...
Definition string_comparison.hpp:26
@ s
The S key.
Definition console_key.hpp:124
@ a
The A key.
Definition console_key.hpp:88
@ c
The C key.
Definition console_key.hpp:92
@ i
The I key.
Definition console_key.hpp:104
@ b
The B key.
Definition console_key.hpp:90
@ separator
The Separator key.
Definition console_key.hpp:172
@ escape
The ESC (ESCAPE) key.
Definition console_key.hpp:34
@ stream
Supports reliable, two-way, connection-based byte streams without the duplication of data and without...
Definition socket_type.hpp:36
size_type
Specifies how rows or columns of user interface (UI) elements should be sized relative to their conta...
Definition size_type.hpp:22
Contains xtd::hash_code class.
Contains xtd::icomparable interface.
Contains xtd::iequatable interface.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
const_reference front() const
Gets the first element.
Definition read_only_span.hpp:218
const_reverse_iterator rend() const
Returns a reverse iterator to the end.
Definition read_only_span.hpp:237
const_iterator begin() const
Returns an iterator to the beginning.
Definition read_only_span.hpp:183
const_iterator cbegin() const
Returns an iterator to the beginning.
Definition read_only_span.hpp:187
read_only_span< type_t, count > first() const
Obtains a subspan consisting of the first count elements of the sequence.
Definition read_only_span.hpp:282
const_iterator end() const
Returns an iterator to the end.
Definition read_only_span.hpp:213
read_only_span< type_t, count > last() const
Obtains a subspan consisting of the last N elements of the sequence.
Definition read_only_span.hpp:307
const_iterator cend() const
Returns an iterator to the end.
Definition read_only_span.hpp:190
const_reference operator[](size_type index) const
Gets the element at the specified zero-based index.
Definition read_only_span.hpp:400
const_reverse_iterator rbegin() const
Returns a reverse iterator to the beginning.
Definition read_only_span.hpp:233
const_reverse_iterator crbegin() const
Returns a reverse iterator to the beginning.
Definition read_only_span.hpp:194
const_reference at(size_type pos) const
Gets the specified element with bounds checking.
Definition read_only_span.hpp:255
constexpr size_type length() const noexcept
Returns the length of the current read_only_span.
Definition read_only_span.hpp:229
const_reference back() const
Gets the last element.
Definition read_only_span.hpp:176
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
const_reverse_iterator crend() const
Returns a reverse iterator to the end.
Definition read_only_span.hpp:197
xtd::array< std::remove_cv_t< type_t > > to_array() const noexcept
Copies the contents of this read_only_span into a new array.
Definition read_only_span.hpp:368
Contains xtd::null pointer valiue.
Contains xtd::object class.
Contains xtd::parse methods.
Contains xtd::string_comparison enum class.
Contains xtd::string_split_options enum class.
Supports a simple iteration over a generic collection.
Definition enumerator.hpp:38
Contains xtd::to_string methods.
Contains xtd fundamental types.
Contains unused_ keyword.