xtd 0.2.0
Loading...
Searching...
No Matches
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
847 base_type & chars() noexcept {return chars_;}
848
852
855 const_reverse_iterator crend() const {return chars_.crend();}
856
864 const_pointer data() const noexcept {return chars_.data();}
865
868 bool empty() const noexcept {return chars_.empty();}
869
873
877 const_reference front() const {return operator[](0);}
878
882 size_type length() const noexcept {return chars_.size();}
883
886 size_type max_size() const noexcept {return chars_.max_size();}
887
890 const_reverse_iterator rbegin() const {return chars_.crbegin();}
891
894 const_reverse_iterator rend() const {return chars_.crend();}
895
898 size_type size() const noexcept {return chars_.size();}
900
902
907 const_reference at(size_type pos) const {return operator [](pos);}
908
927 int32 compare(const basic_string & str) const {return chars_.compare(str);}
949 int32 compare(size_type pos1, size_type count1, const basic_string & str) const {return chars_.compare(pos1, count1, str);}
973 int32 compare(size_type pos1, size_type count1, const basic_string & str, size_type pos2) const {return chars_.compare(pos1, count1, str, pos2);}
998 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);}
1017 int32 compare(const_pointer s) const {return chars_.compare(s);}
1039 int32 compare(size_type pos1, size_type count1, const_pointer s) const {return chars_.compare(pos1, count1, s);}
1062 int32 compare(size_type pos1, size_type count1, const_pointer s, size_type count2) const {return chars_.compare(pos1, count1, s, count2);}
1063
1073 int32 compare_to(const object & value) const {
1075 return compare_to(static_cast<const basic_string&>(value));
1076 }
1077
1085 int32 compare_to(const basic_string & value) const noexcept override {return chars_.compare(value.chars_);}
1086
1090 virtual bool contains(value_type value) const noexcept {return find(value) != npos;}
1094 virtual bool contains(const basic_string & value) const noexcept {return find(value) != npos;}
1095
1099 bool equals(const object & obj) const noexcept override {return dynamic_cast<const basic_string*>(&obj) && equals(static_cast<const basic_string&>(obj));}
1104 bool equals(const basic_string & value) const noexcept override {return equals(value, false);}
1110 bool equals(const basic_string & value, bool ignore_case) const noexcept {
1111 if (ignore_case) return to_upper().chars_ == value.to_upper().chars_;
1112 return chars_ == value.chars_;
1113 }
1114
1118 bool ends_with(value_type value) const noexcept {return ends_with(value, false);}
1123 bool ends_with(value_type value, bool ignore_case) const noexcept {
1124 if (ignore_case) return to_lower().rfind(static_cast<value_type>(tolower(value))) == size() - 1;
1125 return rfind(value) == size() - 1;
1126 }
1127
1130 bool ends_with(const basic_string & value) const noexcept {return ends_with(value, xtd::string_comparison::ordinal);}
1135 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);}
1140 bool ends_with(const basic_string & value, xtd::string_comparison comparison_type) const noexcept {
1141 if (comparison_type == xtd::string_comparison::ordinal_ignore_case) return to_lower().rfind(value.to_lower()) + value.to_lower().size() == size();
1142 return rfind(value) + value.size() == size();
1143 }
1144
1148 size_type find(const basic_string & str) const {return chars_.find(str);}
1154 size_type find(const basic_string & str, size_type pos) const {return chars_.find(str, pos);}
1162 size_type find(const_pointer s, size_type pos, size_type count) const {return chars_.find(s, pos, count);}
1168 size_type find(const_pointer s) const {return chars_.find(s);}
1175 size_type find(const_pointer s, size_type pos) const {return chars_.find(s, pos);}
1180 size_type find(value_type ch) const {return chars_.find(ch);}
1186 size_type find(value_type ch, size_type pos) const {return chars_.find(ch, pos);}
1187
1192 size_type find_first_of(const basic_string & str) const {return chars_.find_first_of(str);}
1198 size_type find_first_of(const basic_string & str, size_type pos) const {return chars_.find_first_of(str, pos);}
1206 size_type find_first_of(const_pointer s, size_type pos, size_type count) const {return chars_.find_first_of(s, pos, count);}
1212 size_type find_first_of(const_pointer s) const {return chars_.find_first_of(s);}
1219 size_type find_first_of(const_pointer s, size_type pos) const {return chars_.find_first_of(s, pos);}
1224 size_type find_first_of(char_t ch) const {return chars_.find_first_of(ch);}
1230 size_type find_first_of(char_t ch, size_type pos) const {return chars_.find_first_of(ch, pos);}
1231
1236 size_type find_first_not_of(const basic_string & str) const {return chars_.find_first_not_of(str);}
1242 size_type find_first_not_of(const basic_string & str, size_type pos) const {return chars_.find_first_not_of(str, pos);}
1250 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);}
1256 size_type find_first_not_of(const_pointer s) const {return chars_.find_first_not_of(s);}
1263 size_type find_first_not_of(const_pointer s, size_type pos) const {return chars_.find_first_not_of(s, pos);}
1268 size_type find_first_not_of(char_t ch) const {return chars_.find_first_not_of(ch);}
1274 size_type find_first_not_of(char_t ch, size_type pos) const {return chars_.find_first_not_of(ch, pos);}
1275
1280 size_type find_last_of(const basic_string & str) const {return chars_.find_last_of(str);}
1286 size_type find_last_of(const basic_string & str, size_type pos) const {return chars_.find_last_of(str, pos);}
1294 size_type find_last_of(const_pointer s, size_type pos, size_type count) const {return chars_.find_last_of(s, pos, count);}
1300 size_type find_last_of(const_pointer s) const {return chars_.find_last_of(s);}
1307 size_type find_last_of(const_pointer s, size_type pos) const {return chars_.find_last_of(s, pos);}
1312 size_type find_last_of(char_t ch) const {return chars_.find_last_of(ch);}
1318 size_type find_last_of(char_t ch, size_type pos) const {return chars_.find_last_of(ch, pos);}
1319
1324 size_type find_last_not_of(const basic_string & str) const {return chars_.find_last_not_of(str);}
1330 size_type find_last_not_of(const basic_string & str, size_type pos) const {return chars_.find_last_not_of(str, pos);}
1338 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);}
1344 size_type find_last_not_of(const_pointer s) const {return chars_.find_last_not_of(s);}
1351 size_type find_last_not_of(const_pointer s, size_type pos) const {return chars_.find_last_not_of(s, pos);}
1356 size_type find_last_not_of(char_t ch) const {return chars_.find_last_not_of(ch);}
1362 size_type find_last_not_of(char_t ch, size_type pos) const {return chars_.find_last_not_of(ch, pos);}
1363
1366 allocator_type get_allocator() const {return chars_.get_allocator();}
1367
1370 virtual const base_type & get_base_type() const noexcept {return chars_;}
1371
1374 xtd::size get_hash_code() const noexcept override {return xtd::hash_code::combine(chars_);}
1375
1376 enumerator_type get_enumerator() const noexcept override {
1377 class basic_string_enumerator : public xtd::collections::generic::ienumerator<value_type> {
1378 public:
1379 explicit basic_string_enumerator(const basic_string & chars) : chars_(chars) {}
1380
1381 const value_type & current() const override {return chars_[index_];}
1382
1383 bool move_next() override {return ++index_ < chars_.size();}
1384
1385 void reset() override {index_ = basic_string::npos;}
1386
1387 protected:
1388 const basic_string& chars_;
1389 xtd::size index_ = basic_string::npos;
1390 };
1391 return {new_ptr<basic_string_enumerator>(*this)};
1392 }
1393
1397 xtd::size index_of(const basic_string & value) const noexcept {return index_of(value, 0, size());}
1402 xtd::size index_of(const basic_string & value, xtd::size start_index) const {return index_of(value, start_index, size() - start_index);}
1409 xtd::size index_of(const basic_string & value, xtd::size start_index, xtd::size count) const {
1411 auto result = find(value, start_index);
1412 return result > start_index + count ? npos : result;
1413 }
1414
1417 xtd::size index_of(value_type value) const noexcept {return index_of(value, 0, size());}
1422 xtd::size index_of(value_type value, xtd::size start_index) const {return index_of(value, start_index, size() - start_index);}
1431 auto result = find(value, start_index);
1432 return result > start_index + count ? npos : result;
1433 }
1434
1438 xtd::size index_of_any(const xtd::array<value_type>& values) const noexcept;
1444 xtd::size index_of_any(const xtd::array<value_type>& values, xtd::size start_index) const;
1453 xtd::size index_of_any(const std::initializer_list<value_type>& values) const noexcept;
1454 xtd::size index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index) const;
1455 xtd::size index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index, xtd::size count) const;
1457
1464 basic_string insert(xtd::size start_index, const basic_string & value) const {
1466 auto result = *this;
1467 result.chars_.insert(start_index, value);
1468 return result;
1469 }
1470
1474 [[deprecated("Replaced by xtd::basic_string::is_empty(const xtd::basic_string&) - Will be removed in version 0.4.0.")]]
1475 bool is_empty() const noexcept {return is_empty(*this);}
1476
1480 xtd::size last_index_of(const basic_string & value) const noexcept {return last_index_of(value, 0, size());}
1486 xtd::size last_index_of(const basic_string & value, xtd::size start_index) const {return last_index_of(value, start_index, size() - start_index);}
1493 xtd::size last_index_of(const basic_string & value, xtd::size start_index, xtd::size count) const {
1495 auto result = rfind(value, start_index + count - value.size());
1496 return result < start_index ? npos : result;
1497 }
1498
1501 xtd::size last_index_of(value_type value) const noexcept {return last_index_of(value, 0, size());}
1507 xtd::size last_index_of(value_type value, xtd::size start_index) const {return last_index_of(value, start_index, size() - start_index);}
1517 auto result = rfind(value, start_index + count - 1);
1518 return result < start_index ? npos : result;
1519 }
1520
1537 xtd::size last_index_of_any(const std::initializer_list<value_type>& values) const noexcept;
1538 xtd::size last_index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index) const;
1539 xtd::size last_index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index, xtd::size count) const;
1541
1547 basic_string pad_left(xtd::size total_width) const noexcept {return pad_left(total_width, ' ');}
1554 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;}
1555
1561 basic_string pad_right(xtd::size total_width) const noexcept {return pad_right(total_width, ' ');}
1568 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);}
1569
1574 basic_string quoted() const {return quoted('"', '\\');}
1579 basic_string quoted(value_type delimiter) const {return quoted(delimiter, '\\');}
1586 std::wstringstream ss;
1587 if constexpr(std::is_same_v<xtd::wchar, value_type>) ss << std::quoted(chars_, delimiter, escape);
1588 else ss << std::quoted(__xtd_convert_to_string<xtd::wchar>(chars_), static_cast<xtd::wchar>(delimiter), static_cast<xtd::wchar>(escape));
1589 return ss.str();
1590 }
1591
1595 basic_string remove(xtd::size start_index) const {return remove(start_index, size() - start_index);}
1602 auto result = *this;
1603 result.chars_.erase(start_index, count);
1604 return result;
1605 }
1606
1611 basic_string replace(value_type old_char, value_type new_char) const noexcept {return replace(string(1, old_char), string(1, new_char));}
1617 basic_string replace(const basic_string & old_string, const basic_string & new_string) const noexcept {
1618 auto result = *this;
1619 auto old_size = old_string.size();
1620 auto new_size = new_string.size();
1621 auto index = xtd::size {0};
1622 while (true) {
1623 index = result.find(old_string, index);
1624 if (index == npos) break;
1625 if (old_size == new_size) result.chars_.replace(index, old_size, new_string);
1626 else {
1627 result.chars_.erase(index, old_string.size());
1628 result.chars_.insert(index, new_string);
1629 }
1630 index += new_string.size();
1631 }
1632 return result;
1633 }
1634
1638 size_type rfind(const basic_string & str) const {return chars_.rfind(str);}
1644 size_type rfind(const basic_string & str, size_type pos) const {return chars_.rfind(str, pos);}
1652 size_type rfind(const_pointer s, size_type pos, size_type count) const {return chars_.rfind(s, pos, count);}
1658 size_type rfind(const_pointer s) const {return chars_.rfind(s);}
1665 size_type rfind(const_pointer s, size_type pos) const {return chars_.rfind(s, pos);}
1670 size_type rfind(value_type ch) const {return chars_.rfind(ch);}
1676 size_type rfind(value_type ch, size_type pos) const {return chars_.rfind(ch, pos);}
1677
1682 xtd::array<basic_string> split() const noexcept;
1688 xtd::array<basic_string> split(value_type separator) const noexcept;
1705 xtd::array<basic_string> split(value_type separator, xtd::string_split_options options) const noexcept;
1714 xtd::array<basic_string> split(value_type separator, xtd::size count) const noexcept;
1726 xtd::array<basic_string> split(value_type separator, xtd::size count, xtd::string_split_options options) const noexcept;
1732 xtd::array<basic_string> split(const xtd::array<value_type>& separators) const noexcept;
1749 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::string_split_options options) const noexcept;
1758 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::size count) const noexcept;
1770 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::size count, xtd::string_split_options options) const noexcept;
1771
1776 bool starts_with(value_type value) const noexcept {return starts_with(value, false);}
1782 bool starts_with(value_type value, bool ignore_case) const noexcept {
1783 if (ignore_case) return to_lower().find(static_cast<value_type>(tolower(value))) == 0;
1784 return find(value) == 0;
1785 }
1790 bool starts_with(const basic_string & value) const noexcept {return starts_with(value, string_comparison::ordinal);}
1796 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);}
1801 bool starts_with(const basic_string & value, xtd::string_comparison comparison_type) const noexcept {
1802 if (comparison_type == xtd::string_comparison::ordinal_ignore_case) return to_lower().find(value.to_lower()) == 0;
1803 return find(value) == 0;
1804 }
1805
1810 basic_string substr() const {return chars_.substr();}
1816 basic_string substr(size_type pos) const {
1818 return chars_.substr(pos);
1819 }
1826 basic_string substr(size_type pos, size_type count) const {
1828 return chars_.substr(pos, count);
1829 }
1830
1836 basic_string substring(xtd::size start_index) const {
1838 return substr(start_index);
1839 }
1845 basic_string substring(xtd::size start_index, xtd::size length) const {
1847 return substr(start_index, length);
1848 }
1849
1852 xtd::array<value_type> to_array() const noexcept;
1856 xtd::array<value_type> to_array(xtd::size start_index) const;
1861 xtd::array<value_type> to_array(xtd::size start_index, xtd::size length) const;
1862
1865 xtd::array<value_type> to_char_array() const noexcept;
1870 xtd::array<value_type> to_char_array(xtd::size start_index, xtd::size length) const;
1871
1874 basic_string to_lower() const noexcept {
1875 auto result = basic_string::empty_string;
1876 std::for_each(chars_.begin(), chars_.end(), [&](auto c) {result += static_cast<value_type>(std::tolower(c));});
1877 return result;
1878 }
1879
1883 basic_string<char> to_string() const noexcept override {
1884 if constexpr(std::is_same_v<char, char_t>) return chars_;
1885 else return __xtd_convert_to_string<char>(chars_);
1886 }
1887
1890 basic_string to_title_case() const noexcept;
1891
1894 basic_string<xtd::char16> to_u16string() const noexcept {
1895 if constexpr(std::is_same_v<xtd::char16, char_t>) return chars_;
1896 else return __xtd_convert_to_string<xtd::char16>(chars_);
1897 }
1898
1901 basic_string<xtd::char32> to_u32string() const noexcept {
1902 if constexpr(std::is_same_v<xtd::char32, char_t>) return chars_;
1903 else return __xtd_convert_to_string<xtd::char32>(chars_);
1904 }
1905
1908 basic_string<xtd::char8> to_u8string() const noexcept {
1909 if constexpr(std::is_same_v<xtd::char8, char_t>) return chars_;
1910 else return __xtd_convert_to_string<xtd::char8>(chars_);
1911 }
1912
1915 basic_string to_upper() const noexcept {
1916 auto result = basic_string::empty_string;
1917 std::for_each(chars_.begin(), chars_.end(), [&](auto c) {result += static_cast<value_type>(std::toupper(c));});
1918 return result;
1919 }
1920
1923 basic_string<xtd::wchar> to_wstring() const noexcept {
1924 if constexpr(std::is_same_v<xtd::wchar, char_t>) return chars_;
1925 else return __xtd_convert_to_string<xtd::wchar>(chars_);
1926 }
1927
1932 basic_string trim() const noexcept {return trim(default_trim_chars);}
1937 basic_string trim(value_type trim_char) const noexcept;
1942 basic_string trim(const xtd::array<value_type>& trim_chars) const noexcept;
1943
1948 basic_string trim_end() const noexcept {return trim_end(default_trim_chars);}
1953 basic_string trim_end(value_type trim_char) const noexcept;
1958 basic_string trim_end(const xtd::array<value_type>& trim_chars) const noexcept;
1959
1964 basic_string trim_start() const noexcept {return trim_start(default_trim_chars);}
1969 basic_string trim_start(value_type trim_char) const noexcept;
1974 basic_string trim_start(const xtd::array<value_type>& trim_chars) const noexcept;
1976
1978
1984 template<class object_t>
1985 [[deprecated("Replaced by typeof_<object_t>().name() - Will be removed in version 0.4.0.")]]
1986 static basic_string class_name() {return get_class_name(full_class_name<object_t>());}
1991 template<class object_t>
1992 [[deprecated("Replaced by typeof_(object).name() - Will be removed in version 0.4.0.")]]
1993 static basic_string class_name(const object_t& object) {return get_class_name(full_class_name(object));}
1998 [[deprecated("Replaced by typeof_(info).name() - Will be removed in version 0.4.0.")]]
1999 static basic_string class_name(const std::type_info & info) {return __xtd_get_class_name(info);}
2000
2010 static int32 compare(const basic_string & str_a, const basic_string & str_b) noexcept {return compare(str_a, str_b, false);}
2021 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);}
2032 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);}
2045 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);}
2059 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);}
2073 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));}
2074
2081 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;}
2088 template<class object_a_t, class object_b_t, class object_c_t, class object_d_t>
2089 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);}
2095 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;}
2101 template<class object_a_t, class object_b_t, class object_c_t>
2102 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);}
2107 static basic_string concat(const basic_string & str_a, const basic_string & str_b) noexcept {return str_a + str_b;}
2112 template<class object_a_t, class object_b_t>
2113 static basic_string concat(object_a_t obj_a, object_b_t obj_b) noexcept {return format("{}{}", obj_a, obj_b);}
2117 static basic_string concat(const xtd::array<basic_string>& values) noexcept;
2119 static basic_string concat(const xtd::array<const_pointer>& values) noexcept;
2120 template<class other_char_t>
2121 static basic_string concat(const xtd::array<const other_char_t*>& values) noexcept;
2122 static basic_string concat(const std::initializer_list<basic_string>& values) noexcept {
2123 auto result = basic_string::empty_string;
2124 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2125 return result;
2126 }
2127 static basic_string concat(const std::initializer_list<const_pointer>& values) noexcept {
2128 auto result = basic_string::empty_string;
2129 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2130 return result;
2131 }
2132 template<class other_char_t>
2133 static basic_string concat(const std::initializer_list<const other_char_t*>& values) noexcept {
2134 auto result = basic_string::empty_string;
2135 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2136 return result;
2137 }
2142 template<class object_t>
2143 static basic_string concat(const xtd::array<object_t>& args) noexcept;
2145 template<class object_t>
2146 static basic_string concat(const std::initializer_list<object_t>& args) noexcept {
2147 basic_string result;
2148 for (const auto& arg : args)
2149 result += format("{}", arg);
2150 return result;
2151 }
2156 template<class value_t>
2157 static basic_string concat(value_t value) noexcept {
2158 return format("{}", value);
2159 }
2160
2181 static basic_string demangle(const basic_string & name) {
2182 if constexpr(std::is_same_v<char, char_t>) return __xtd_demangle(name.chars());
2183 else return __xtd_demangle(__xtd_convert_to_string<char>(name.chars()));
2184 }
2185
2191 static bool equals(const basic_string & a, const basic_string & b) noexcept{return a.equals(b);}
2197 template<class char_a_t, class char_b_t>
2198 static bool equals(const char_a_t* a, const char_b_t* b) noexcept{return basic_string {a}.equals(basic_string {b});}
2199
2206 static bool equals(const basic_string & a, const basic_string & b, bool ignore_case) noexcept {return a.equals(b, ignore_case);}
2213 template<class char_a_t, class char_b_t>
2214 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);}
2215
2222 template<class ...args_t>
2223 static basic_string format(const basic_string<char>& fmt, args_t&& ... args);
2224
2229 template<class object_t>
2230 [[deprecated("Replaced by typeof_<object_t>().full_name() - Will be removed in version 0.4.0.")]]
2231 static basic_string full_class_name() {return demangle(typeid(object_t).name());}
2236 template<class object_t>
2237 [[deprecated("Replaced by typeof_(object).full_name() - Will be removed in version 0.4.0.")]]
2238 static basic_string full_class_name(const object_t& object) {return demangle(typeid(object).name());}
2243 [[deprecated("Replaced by typeof_(info).full_name() - Will be removed in version 0.4.0.")]]
2244 static basic_string full_class_name(const std::type_info & info) {return __xtd_get_full_class_name(info);}
2245
2249 static bool is_empty(const xtd::basic_string<value_type, traits_type, allocator_type>& string) noexcept {return !string.length();}
2250
2257 template<class collection_t>
2258 static basic_string join(const basic_string separator, const collection_t& values) noexcept {
2259 xtd::size i = 0;
2260 basic_string result;
2261 for (const auto& item : values)
2262 result += format("{}{}", (i++ != 0 ? separator : basic_string {}), item);
2263 return result;
2264 }
2272 template<class collection_t>
2273 static basic_string join(const basic_string & separator, const collection_t& values, xtd::size index) {return join(separator, values, index, values.size() - index);}
2282 template<class collection_t>
2283 static basic_string join(const basic_string & separator, const collection_t& values, xtd::size index, xtd::size count) {
2284 if (index > values.size() || index + count > values.size()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range);
2285 xtd::size i = 0;
2286 basic_string result;
2287 for (const auto& item : values) {
2288 if (i >= index) result += format("{}{}", (i != index ? separator : basic_string {}), item);
2289 if (++i >= index + count) break;
2290 }
2291 return result;
2292 }
2293
2295 template<class value_t>
2296 static basic_string join(const basic_string & separator, const std::initializer_list<value_t>& values) noexcept;
2297 template<class value_t>
2298 static basic_string join(const basic_string & separator, const std::initializer_list<value_t>& values, xtd::size index);
2299 template<class value_t>
2300 static basic_string join(const basic_string & separator, const std::initializer_list<value_t>& values, xtd::size index, xtd::size count);
2302
2306 template<class value_t>
2307 static value_t parse(const basic_string & str) {
2308 if constexpr(std::is_same_v<char, char_t>) return xtd::parse<value_t>(str.chars());
2309 else return xtd::parse<value_t>(__xtd_convert_to_string<char>(str.chars()));
2310 }
2311
2371 template<class ...args_t>
2372 static basic_string sprintf(const basic_string & fmt, args_t&& ... args) noexcept {return __sprintf(fmt.c_str(), convert_param(std::forward<args_t>(args)) ...);}
2373
2378 template<class value_t>
2379 static bool try_parse(const basic_string & str, value_t& value) noexcept {
2380 try {
2381 value = parse<value_t>(str);
2382 return true;
2383 } catch (...) {
2384 return false;
2385 }
2386 }
2388
2390
2396 const_reference operator [](xtd::size index) const {
2398 return chars_[index];
2399 }
2400
2403 operator const base_type & () const noexcept {return chars_;}
2404
2408 basic_string& operator =(const basic_string<char>& str) noexcept {
2409 if constexpr(std::is_same<char_t, char>::value) chars_ = str.chars_;
2410 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2411 return *this;
2412 }
2416 basic_string& operator =(const basic_string<xtd::char16>& str) noexcept {
2417 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str.chars_;
2418 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2419 return *this;
2420 }
2424 basic_string& operator =(const basic_string<xtd::char32>& str) noexcept {
2425 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str.chars_;
2426 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2427 return *this;
2428 }
2432 basic_string& operator =(const basic_string<xtd::char8>& str) noexcept {
2433 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str.chars_;
2434 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2435 return *this;
2436 }
2440 basic_string& operator =(const basic_string<xtd::wchar>& str) noexcept {
2441 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str.chars_;
2442 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2443 return *this;
2444 }
2445
2449 basic_string& operator =(basic_string<char>&& str) noexcept {
2450 if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str.chars_);
2451 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2452 return *this;
2453 }
2457 basic_string& operator =(basic_string<xtd::char16>&& str) noexcept {
2458 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str.chars_);
2459 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2460 return *this;
2461 }
2465 basic_string& operator =(basic_string<xtd::char32>&& str) noexcept {
2466 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str.chars_);
2467 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2468 return *this;
2469 }
2473 basic_string& operator =(basic_string<xtd::char8>&& str) noexcept {
2474 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str.chars_);
2475 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2476 return *this;
2477 }
2481 basic_string& operator =(basic_string<xtd::wchar>&& str) noexcept {
2482 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str.chars_);
2483 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2484 return *this;
2485 }
2486
2490 basic_string& operator =(const std::basic_string<char>& str) noexcept {
2491 if constexpr(std::is_same<char_t, char>::value) chars_ = str;
2492 else chars_ = __xtd_convert_to_string<value_type>(str);
2493 return *this;
2494 }
2498 basic_string& operator =(const std::basic_string<xtd::char16>& str) noexcept {
2499 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str;
2500 else chars_ = __xtd_convert_to_string<value_type>(str);
2501 return *this;
2502 }
2506 basic_string& operator =(const std::basic_string<xtd::char32>& str) noexcept {
2507 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str;
2508 else chars_ = __xtd_convert_to_string<value_type>(str);
2509 return *this;
2510 }
2514 basic_string& operator =(const std::basic_string<xtd::char8>& str) noexcept {
2515 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str;
2516 else chars_ = __xtd_convert_to_string<value_type>(str);
2517 return *this;
2518 }
2522 basic_string& operator =(const std::basic_string<xtd::wchar>& str) noexcept {
2523 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str;
2524 else chars_ = __xtd_convert_to_string<value_type>(str);
2525 return *this;
2526 }
2527
2531 basic_string& operator =(std::basic_string<char>&& str) noexcept {
2532 if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str);
2533 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2534 return *this;
2535 }
2539 basic_string& operator =(std::basic_string<xtd::char16>&& str) noexcept {
2540 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str);
2541 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2542 return *this;
2543 }
2547 basic_string& operator =(std::basic_string<xtd::char32>&& str) noexcept {
2548 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str);
2549 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2550 return *this;
2551 }
2555 basic_string& operator =(std::basic_string<xtd::char8>&& str) noexcept {
2556 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str);
2557 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2558 return *this;
2559 }
2563 basic_string& operator =(std::basic_string<xtd::wchar>&& str) noexcept {
2564 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str);
2565 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2566 return *this;
2567 }
2568
2573 basic_string& operator =(const char* str) {
2575 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str);
2576 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str));
2577 return *this;
2578 }
2583 basic_string& operator =(const xtd::char16 * str) {
2585 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str);
2586 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str));
2587 return *this;
2588 }
2593 basic_string& operator =(const xtd::char32 * str) {
2595 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str);
2596 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str));
2597 return *this;
2598 }
2603 basic_string& operator =(const xtd::char8 * str) {
2605 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str);
2606 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str));
2607 return *this;
2608 }
2613 basic_string& operator =(const xtd::wchar * str) {
2615 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
2616 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
2617 return *this;
2618 }
2619
2623 basic_string& operator =(char character) {
2624 *this = basic_string(1, character);
2625 return *this;
2626 }
2630 basic_string& operator =(xtd::char16 character) {
2631 *this = basic_string(1, character);
2632 return *this;
2633 }
2637 basic_string& operator =(xtd::char32 character) {
2638 *this = basic_string(1, character);
2639 return *this;
2640 }
2644 basic_string& operator =(xtd::char8 character) {
2645 *this = basic_string(1, character);
2646 return *this;
2647 }
2651 basic_string& operator =(xtd::wchar character) {
2652 *this = basic_string(1, character);
2653 return *this;
2654 }
2655
2659 basic_string& operator =(const std::initializer_list<char>& il) {
2660 *this = basic_string(il);
2661 return *this;
2662 }
2666 basic_string& operator =(const std::initializer_list<xtd::char16>& il) {
2667 *this = basic_string(il);
2668 return *this;
2669 }
2673 basic_string& operator =(const std::initializer_list<xtd::char32>& il) {
2674 *this = basic_string(il);
2675 return *this;
2676 }
2680 basic_string& operator =(const std::initializer_list<xtd::char8>& il) {
2681 *this = basic_string(il);
2682 return *this;
2683 }
2687 basic_string& operator =(const std::initializer_list<xtd::wchar>& il) {
2688 *this = basic_string(il);
2689 return *this;
2690 }
2691
2695 basic_string & operator +=(const basic_string<char>& str) {
2696 if constexpr(std::is_same_v<char, char_t>) chars_ += str.chars_;
2697 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2698 return *this;
2699 }
2703 basic_string & operator +=(const basic_string<xtd::char16>& str) {
2704 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += str.chars_;
2705 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2706 return *this;
2707 }
2711 basic_string & operator +=(const basic_string<xtd::char32>& str) {
2712 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += str.chars_;
2713 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2714 return *this;
2715 }
2719 basic_string & operator +=(const basic_string<xtd::char8>& str) {
2720 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += str.chars_;
2721 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2722 return *this;
2723 }
2727 basic_string & operator +=(const basic_string<xtd::wchar>& str) {
2728 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += str.chars_;
2729 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2730 return *this;
2731 }
2732
2736 basic_string & operator +=(basic_string<char>&& str) {
2737 if constexpr(std::is_same_v<char, char_t>) chars_ += std::move(str.chars_);
2738 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2739 return *this;
2740 }
2744 basic_string & operator +=(basic_string<xtd::char16>&& str) {
2745 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += std::move(str.chars_);
2746 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2747 return *this;
2748 }
2752 basic_string & operator +=(basic_string<xtd::char32>&& str) {
2753 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += std::move(str.chars_);
2754 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2755 return *this;
2756 }
2760 basic_string & operator +=(basic_string<xtd::char8>&& str) {
2761 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += std::move(str.chars_);
2762 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2763 return *this;
2764 }
2768 basic_string & operator +=(basic_string<xtd::wchar>&& str) {
2769 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += std::move(str.chars_);
2770 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2771 return *this;
2772 }
2773
2777 basic_string & operator +=(const std::basic_string<char>& str) {
2778 if constexpr(std::is_same_v<char, char_t>) chars_ += str;
2779 else chars_ += __xtd_convert_to_string<value_type>(str);
2780 return *this;
2781 }
2785 basic_string & operator +=(const std::basic_string<xtd::char16>& str) {
2786 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += str;
2787 else chars_ += __xtd_convert_to_string<value_type>(str);
2788 return *this;
2789 }
2793 basic_string & operator +=(const std::basic_string<xtd::char32>& str) {
2794 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += str;
2795 else chars_ += __xtd_convert_to_string<value_type>(str);
2796 return *this;
2797 }
2801 basic_string & operator +=(const std::basic_string<xtd::char8>& str) {
2802 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += str;
2803 else chars_ += __xtd_convert_to_string<value_type>(str);
2804 return *this;
2805 }
2809 basic_string & operator +=(const std::basic_string<xtd::wchar>& str) {
2810 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += str;
2811 else chars_ += __xtd_convert_to_string<value_type>(str);
2812 return *this;
2813 }
2814
2818 basic_string & operator +=(const char* str) {
2819 chars_ += basic_string(str).chars_;
2820 return *this;
2821 }
2825 basic_string & operator +=(const xtd::char16 * str) {
2826 chars_.append(basic_string(str).chars_); return *this;
2827 }
2831 basic_string & operator +=(const xtd::char32 * str) {
2832 chars_ += basic_string(str).chars_;
2833 return *this;
2834 }
2838 basic_string & operator +=(const xtd::char8 * str) {
2839 chars_ += basic_string(str).chars_;
2840 return *this;
2841 }
2845 basic_string & operator +=(const xtd::wchar * str) {
2846 chars_ += basic_string(str).chars_;
2847 return *this;
2848 }
2852 basic_string & operator +=(char ch) {
2853 chars_ += basic_string(1, ch).chars_;
2854 return *this;
2855 }
2859 basic_string & operator +=(xtd::char16 ch) {
2860 chars_ += basic_string(1, ch).chars_;
2861 return *this;
2862 }
2866 basic_string & operator +=(xtd::char32 ch) {
2867 chars_ += basic_string(1, ch).chars_;
2868 return *this;
2869 }
2873 basic_string & operator +=(xtd::char8 ch) {
2874 chars_ += basic_string(1, ch).chars_;
2875 return *this;
2876 }
2880 basic_string & operator +=(xtd::wchar ch) {
2881 chars_ += basic_string(1, ch).chars_;
2882 return *this;
2883 }
2884
2889 friend basic_string operator +(const basic_string & lhs, const basic_string<char>& rhs) {
2890 auto result = lhs;
2891 result += rhs;
2892 return result;
2893 }
2898 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char16>& rhs) {
2899 auto result = lhs;
2900 result += rhs;
2901 return result;
2902 }
2907 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char32>& rhs) {
2908 auto result = lhs;
2909 result += rhs;
2910 return result;
2911 }
2916 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char8>& rhs) {
2917 auto result = lhs;
2918 result += rhs;
2919 return result;
2920 }
2925 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::wchar>& rhs) {
2926 auto result = lhs;
2927 result += rhs;
2928 return result;
2929 }
2930
2935 friend basic_string operator +(basic_string&& lhs, basic_string<char>&& rhs) {
2936 auto result = std::move(lhs);
2937 result += std::move(rhs);
2938 return result;
2939 }
2944 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char16>&& rhs) {
2945 auto result = std::move(lhs);
2946 result += std::move(rhs);
2947 return result;
2948 }
2953 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char32>&& rhs) {
2954 auto result = std::move(lhs);
2955 result += std::move(rhs);
2956 return result;
2957 }
2962 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char8>&& rhs) {
2963 auto result = std::move(lhs);
2964 result += std::move(rhs);
2965 return result;
2966 }
2971 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::wchar>&& rhs) {
2972 auto result = std::move(lhs);
2973 result += std::move(rhs);
2974 return result;
2975 }
2976
2981 friend basic_string operator +(basic_string&& lhs, const basic_string<char>& rhs) {
2982 auto result = std::move(lhs);
2983 result += rhs;
2984 return result;
2985 }
2990 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char16>& rhs) {
2991 auto result = std::move(lhs);
2992 result += rhs;
2993 return result;
2994 }
2999 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char32>& rhs) {
3000 auto result = std::move(lhs);
3001 result += rhs;
3002 return result;
3003 }
3008 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char8>& rhs) {
3009 auto result = std::move(lhs);
3010 result += rhs;
3011 return result;
3012 }
3017 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::wchar>& rhs) {
3018 auto result = std::move(lhs);
3019 result += rhs;
3020 return result;
3021 }
3022
3027 friend basic_string operator +(const basic_string & lhs, basic_string<char>&& rhs) {
3028 auto result = lhs;
3029 result += std::move(rhs);
3030 return result;
3031 }
3036 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char16>&& rhs) {
3037 auto result = lhs;
3038 result += std::move(rhs);
3039 return result;
3040 }
3045 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char32>&& rhs) {
3046 auto result = lhs;
3047 result += std::move(rhs);
3048 return result;
3049 }
3054 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char8>&& rhs) {
3055 auto result = lhs;
3056 result += std::move(rhs);
3057 return result;
3058 }
3063 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::wchar>&& rhs) {
3064 auto result = lhs;
3065 result += std::move(rhs);
3066 return result;
3067 }
3068
3073 friend basic_string operator +(const basic_string & lhs, const std::basic_string<char>& rhs) {
3074 auto result = lhs;
3075 result += rhs;
3076 return result;
3077 }
3082 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char16>& rhs) {
3083 auto result = lhs;
3084 result += rhs;
3085 return result;
3086 }
3091 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char32>& rhs) {
3092 auto result = lhs;
3093 result += rhs;
3094 return result;
3095 }
3100 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char8>& rhs) {
3101 auto result = lhs;
3102 result += rhs;
3103 return result;
3104 }
3109 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::wchar>& rhs) {
3110 auto result = lhs;
3111 result += rhs;
3112 return result;
3113 }
3114
3119 friend basic_string operator +(const std::basic_string<char>& lhs, const basic_string & rhs) {
3120 auto result = lhs;
3121 if constexpr(std::is_same_v<char, char_t>) result += rhs.chars();
3122 else result += __xtd_convert_to_string<char>(rhs.chars());
3123 return result;
3124 }
3129 friend basic_string operator +(const std::basic_string<xtd::char16>& lhs, const basic_string & rhs) {
3130 auto result = lhs;
3131 if constexpr(std::is_same_v<xtd::char16, char_t>) result += rhs.chars();
3132 else result += __xtd_convert_to_string<xtd::char16>(rhs.chars());
3133 return result;
3134 }
3139 friend basic_string operator +(const std::basic_string<xtd::char32>& lhs, const basic_string & rhs) {
3140 auto result = lhs;
3141 if constexpr(std::is_same_v<xtd::char32, char_t>) result += rhs.chars();
3142 else result += __xtd_convert_to_string<xtd::char32>(rhs.chars());
3143 return result;
3144 }
3149 friend basic_string operator +(const std::basic_string<xtd::char8>& lhs, const basic_string & rhs) {
3150 auto result = lhs;
3151 if constexpr(std::is_same_v<xtd::char8, char_t>) result += rhs.chars();
3152 else result += __xtd_convert_to_string<xtd::char8>(rhs.chars());
3153 return result;
3154 }
3159 friend basic_string operator +(const std::basic_string<xtd::wchar>& lhs, const basic_string & rhs) {
3160 auto result = lhs;
3161 if constexpr(std::is_same_v<xtd::wchar, char_t>) result += rhs.chars();
3162 else result += __xtd_convert_to_string<xtd::wchar>(rhs.chars());
3163 return result;
3164 }
3165
3170 friend basic_string operator +(const basic_string & lhs, const char* rhs) {
3171 auto result = lhs;
3172 result += rhs;
3173 return result;
3174 }
3179 friend basic_string operator +(const basic_string & lhs, const xtd::char16 * rhs) {
3180 auto result = lhs;
3181 result += rhs;
3182 return result;
3183 }
3188 friend basic_string operator +(const basic_string & lhs, const xtd::char32 * rhs) {
3189 auto result = lhs;
3190 result += rhs;
3191 return result;
3192 }
3197 friend basic_string operator +(const basic_string & lhs, const xtd::char8 * rhs) {
3198 auto result = lhs;
3199 result += rhs;
3200 return result;
3201 }
3206 friend basic_string operator +(const basic_string & lhs, const xtd::wchar * rhs) {
3207 auto result = lhs;
3208 result += rhs;
3209 return result;
3210 }
3211
3216 friend basic_string operator +(basic_string&& lhs, const char* rhs) {
3217 auto result = std::move(lhs);
3218 result += rhs;
3219 return result;
3220 }
3225 friend basic_string operator +(basic_string&& lhs, const xtd::char16 * rhs) {
3226 auto result = std::move(lhs);
3227 result += rhs;
3228 return result;
3229 }
3234 friend basic_string operator +(basic_string&& lhs, const xtd::char32 * rhs) {
3235 auto result = std::move(lhs);
3236 result += rhs;
3237 return result;
3238 }
3243 friend basic_string operator +(basic_string&& lhs, const xtd::char8 * rhs) {
3244 auto result = std::move(lhs);
3245 result += rhs;
3246 return result;
3247 }
3252 friend basic_string operator +(basic_string&& lhs, const xtd::wchar * rhs) {
3253 auto result = std::move(lhs);
3254 result += rhs;
3255 return result;
3256 }
3257
3262 friend basic_string operator +(const char* lhs, const basic_string & rhs) {
3263 auto result = basic_string(lhs);
3264 result += rhs;
3265 return result;
3266 }
3271 friend basic_string operator +(const xtd::char16 * lhs, const basic_string & rhs) {
3272 auto result = basic_string(lhs);
3273 result += rhs;
3274 return result;
3275 }
3280 friend basic_string operator +(const xtd::char32 * lhs, const basic_string & rhs) {
3281 auto result = basic_string(lhs);
3282 result += rhs;
3283 return result;
3284 }
3289 friend basic_string operator +(const xtd::char8 * lhs, const basic_string & rhs) {
3290 auto result = basic_string(lhs);
3291 result += rhs;
3292 return result;
3293 }
3298 friend basic_string operator +(const xtd::wchar * lhs, const basic_string & rhs) {
3299 auto result = basic_string(lhs);
3300 result += rhs;
3301 return result;
3302 }
3303
3308 friend basic_string operator +(const char* lhs, basic_string&& rhs) {
3309 auto result = basic_string(lhs);
3310 result += std::move(rhs);
3311 return result;
3312 }
3317 friend basic_string operator +(const xtd::char16 * lhs, basic_string&& rhs) {
3318 auto result = basic_string(lhs);
3319 result += std::move(rhs);
3320 return result;
3321 }
3326 friend basic_string operator +(const xtd::char32 * lhs, basic_string&& rhs) {
3327 auto result = basic_string(lhs);
3328 result += std::move(rhs);
3329 return result;
3330 }
3335 friend basic_string operator +(const xtd::char8 * lhs, basic_string&& rhs) {
3336 auto result = basic_string(lhs);
3337 result += std::move(rhs);
3338 return result;
3339 }
3344 friend basic_string operator +(const xtd::wchar * lhs, basic_string&& rhs) {
3345 auto result = basic_string(lhs);
3346 result += std::move(rhs);
3347 return result;
3348 }
3349
3354 friend basic_string operator +(const basic_string & lhs, const char rhs) {
3355 auto result = lhs;
3356 result += rhs;
3357 return result;
3358 }
3363 friend basic_string operator +(const basic_string & lhs, const xtd::char16 rhs) {
3364 auto result = lhs;
3365 result += rhs;
3366 return result;
3367 }
3372 friend basic_string operator +(const basic_string & lhs, const xtd::char32 rhs) {
3373 auto result = lhs;
3374 result += rhs;
3375 return result;
3376 }
3381 friend basic_string operator +(const basic_string & lhs, const xtd::char8 rhs) {
3382 auto result = lhs;
3383 result += rhs;
3384 return result;
3385 }
3390 friend basic_string operator +(const basic_string & lhs, const xtd::wchar rhs) {
3391 auto result = lhs;
3392 result += rhs;
3393 return result;
3394 }
3395
3400 friend basic_string operator +(basic_string&& lhs, const char rhs) {
3401 auto result = std::move(lhs);
3402 result += rhs;
3403 return result;
3404 }
3409 friend basic_string operator +(basic_string&& lhs, const xtd::char16 rhs) {
3410 auto result = std::move(lhs);
3411 result += rhs;
3412 return result;
3413 }
3418 friend basic_string operator +(basic_string&& lhs, const xtd::char32 rhs) {
3419 auto result = std::move(lhs);
3420 result += rhs;
3421 return result;
3422 }
3427 friend basic_string operator +(basic_string&& lhs, const xtd::char8 rhs) {
3428 auto result = std::move(lhs);
3429 result += rhs;
3430 return result;
3431 }
3436 friend basic_string operator +(basic_string&& lhs, const xtd::wchar rhs) {
3437 auto result = std::move(lhs);
3438 result += rhs;
3439 return result;
3440 }
3441
3446 friend basic_string operator +(char lhs, const basic_string & rhs) {
3447 auto result = basic_string(1, lhs);
3448 result += rhs;
3449 return result;
3450 }
3455 friend basic_string operator +(xtd::char16 lhs, const basic_string & rhs) {
3456 auto result = basic_string(1, lhs);
3457 result += rhs;
3458 return result;
3459 }
3464 friend basic_string operator +(xtd::char32 lhs, const basic_string & rhs) {
3465 auto result = basic_string(1, lhs);
3466 result += rhs;
3467 return result;
3468 }
3473 friend basic_string operator +(xtd::char8 lhs, const basic_string & rhs) {
3474 auto result = basic_string(1, lhs);
3475 result += rhs;
3476 return result;
3477 }
3482 friend basic_string operator +(xtd::wchar lhs, const basic_string & rhs) {
3483 auto result = basic_string(1, lhs);
3484 result += rhs;
3485 return result;
3486 }
3487
3492 friend basic_string operator +(char lhs, basic_string&& rhs) {
3493 auto result = basic_string(1, lhs);
3494 result += std::move(rhs);
3495 return result;
3496 }
3501 friend basic_string operator +(xtd::char16 lhs, basic_string&& rhs) {
3502 auto result = basic_string(1, lhs);
3503 result += std::move(rhs);
3504 return result;
3505 }
3510 friend basic_string operator +(xtd::char32 lhs, basic_string&& rhs) {
3511 auto result = basic_string(1, lhs);
3512 result += std::move(rhs);
3513 return result;
3514 }
3519 friend basic_string operator +(xtd::char8 lhs, basic_string&& rhs) {
3520 auto result = basic_string(1, lhs);
3521 result += std::move(rhs);
3522 return result;
3523 }
3528 friend basic_string operator +(xtd::wchar lhs, basic_string&& rhs) {
3529 auto result = basic_string(1, lhs);
3530 result += std::move(rhs);
3531 return result;
3532 }
3533
3542 //friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string& str) {return stream << str.to_string().chars_;}
3543 friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string & str) {
3544 if constexpr(std::is_same_v<char, char_t>) return stream << str.chars();
3545 else return stream << __xtd_convert_to_string<char>(str.chars());
3546 }
3553 friend std::basic_ostream<xtd::wchar>& operator <<(std::basic_ostream<xtd::wchar>& stream, const basic_string & str) {return stream << str.to_wstring().chars();}
3554
3563 friend std::basic_istream<char>& operator >>(std::basic_istream<char>& stream, basic_string & str) {
3564 auto s = std::basic_string<char> {};
3565 stream >> s;
3566 str = s;
3567 return stream;
3568 }
3577 friend std::basic_istream<xtd::wchar>& operator >>(std::basic_istream<xtd::wchar>& stream, basic_string & str) {
3578 auto s = std::basic_string<xtd::wchar> {};
3579 stream >> s;
3580 str = s;
3581 return stream;
3582 }
3584
3585 private:
3586 friend class basic_string<char>;
3587 friend class basic_string<xtd::char16>;
3588 friend class basic_string<xtd::char32>;
3589 friend class basic_string<xtd::char8>;
3590 friend class basic_string<xtd::wchar>;
3591
3592 static const xtd::array<value_type> default_split_separators;
3593 static const xtd::array<value_type> default_trim_chars;
3594
3595 template<class arg_t>
3596 static auto convert_param(arg_t&& arg) noexcept {
3597 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();
3598 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();
3599 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();
3600 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();
3601 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();
3602 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();
3603 else return std::forward<arg_t>(arg);
3604 }
3605
3606 static basic_string get_class_name(const basic_string & full_name) {
3607 auto length = full_name.last_index_of("<");
3608 if (length == npos) length = full_name.length();
3609 if (full_name.last_index_of("::", 0, length) == npos) return full_name;
3610 return full_name.substring(full_name.last_index_of("::", 0, length) + 2);
3611 }
3612
3613 typename base_type::iterator to_base_type_iterator(iterator value) const noexcept {
3614 if (value == begin()) return chars_.begin();
3615 if (value == end()) return chars_.end();
3616 return chars_.begin() + (value - begin());
3617 }
3618
3619 iterator to_iterator(typename base_type::iterator value) const noexcept {
3620 if (value == chars_.begin()) return begin();
3621 if (value == chars_.end()) return end();
3622 return begin() + (value - chars_.begin());
3623 }
3624
3625 base_type chars_;
3626 };
3627}
3628
3629#define __XTD_BASIC_STRING_INTERNAL__
3630#include "basic_string_.hpp"
3631#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:63
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:1417
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:1547
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:1140
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:1338
allocator_type get_allocator() const
Returns the allocator associated with the string.
Definition basic_string.hpp:1366
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:1429
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:1422
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:1192
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:1318
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:1123
enumerator_type get_enumerator() const noexcept override
Returns an enumerator that iterates through a collection.
Definition basic_string.hpp:1376
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:1362
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:1658
virtual const base_type & get_base_type() const noexcept
Returns the underlying base type.
Definition basic_string.hpp:1370
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:1263
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:1486
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:1300
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:1307
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:1236
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:1094
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:1198
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:1464
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:1219
int32 compare(size_type pos1, size_type count1, const_pointer s, size_type count2) const
Compares two character sequences.
Definition basic_string.hpp:1062
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:1493
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:1268
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:1085
basic_string quoted() const
Allows insertion and extraction of quoted strings, such as the ones found in CSV or XML.
Definition basic_string.hpp:1574
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:1168
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:1595
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:1356
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:1600
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:1501
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:1344
bool is_empty() const noexcept
Indicates whether this basic_string is an empty basic_string ("").
Definition basic_string.hpp:1475
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:1180
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:1579
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:1073
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:1568
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:1617
xtd::size get_hash_code() const noexcept override
Returns the hash code for this basic_string.
Definition basic_string.hpp:1374
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:1090
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:1324
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:1242
bool ends_with(value_type value) const noexcept
Determines whether the end of this basic_string matches the specified character.
Definition basic_string.hpp:1118
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:1515
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:1206
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:1409
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:1148
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:1397
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:1274
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:1099
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:1224
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:1256
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:1250
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:1611
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:1135
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:1110
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:1561
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:1286
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:1130
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:1212
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:1480
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:1554
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:1104
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:1312
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:1351
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:1186
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:1280
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:1294
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:1330
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:1154
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:1402
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:1230
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:1585
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:1507
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:1162
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:1175
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:1665
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:40
char_t value_type
Definition ienumerable.hpp:46
typename xtd::collections::generic::extensions::enumerable_iterators< char_t, xtd::collections::generic::ienumerable< char_t > >::const_iterator const_iterator
Definition ienumerable.hpp:50
typename xtd::collections::generic::extensions::enumerable_iterators< char_t, xtd::collections::generic::ienumerable< char_t > >::iterator iterator
Definition ienumerable.hpp:48
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
char16_t char16
Represents a 16-bit unicode character.
Definition char16.hpp:26
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
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.