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
126 inline static constexpr size_type npos = base_type::npos;
127
136 static inline constexpr xtd::size bpos = 0;
137
154 static inline constexpr xtd::size epos = npos - 1;
156
158
161 basic_string() = default;
164 explicit basic_string(const allocator_type & allocator) noexcept;
165
168 basic_string(const basic_string<char>& str) noexcept {
169 if constexpr(std::is_same_v<char, char_t>) chars_ = str.chars_;
170 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
171 }
172
175 basic_string(const basic_string<xtd::char16>& str) noexcept {
176 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = str.chars_;
177 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
178 }
181 basic_string(const basic_string<xtd::char32>& str) noexcept {
182 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = str.chars_;
183 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
184 }
187 basic_string(const basic_string<xtd::char8>& str) noexcept {
188 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = str.chars_;
189 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
190 }
193 basic_string(const basic_string<xtd::wchar>& str) noexcept {
194 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = str.chars_;
195 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
196 }
197
201 basic_string(const basic_string<char>& str, const allocator_type & allocator) noexcept {
202 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, allocator);
203 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
204 }
208 basic_string(const basic_string<xtd::char16>& str, const allocator_type & allocator) noexcept {
209 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, allocator);
210 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
211 }
215 basic_string(const basic_string<xtd::char32>& str, const allocator_type & allocator) noexcept {
216 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, allocator);
217 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
218 }
222 basic_string(const basic_string<xtd::char8>& str, const allocator_type & allocator) noexcept {
223 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, allocator);
224 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
225 }
229 basic_string(const basic_string<xtd::wchar>& str, const allocator_type & allocator) noexcept {
230 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, allocator);
231 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
232 }
233
238 basic_string(const basic_string<char>& str, xtd::size index) {
240 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index);
241 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index)));
242 }
249 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index);
250 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index)));
251 }
258 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index);
259 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index)));
260 }
267 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index);
268 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index)));
269 }
276 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index);
277 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index)));
278 }
279
285 basic_string(const basic_string<char>& str, xtd::size index, const allocator_type & allocator) {
287 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index, allocator);
288 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index)), allocator);
289 }
295 basic_string(const basic_string<xtd::char16>& str, xtd::size index, const allocator_type & allocator) {
297 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index, allocator);
298 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index)), allocator);
299 }
305 basic_string(const basic_string<xtd::char32>& str, xtd::size index, const allocator_type & allocator) {
307 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index, allocator);
308 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index)), allocator);
309 }
315 basic_string(const basic_string<xtd::char8>& str, xtd::size index, const allocator_type & allocator) {
317 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index, allocator);
318 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index)), allocator);
319 }
325 basic_string(const basic_string<xtd::wchar>& str, xtd::size index, const allocator_type & allocator) {
327 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index, allocator);
328 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index)), allocator);
329 }
330
338 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index, count);
339 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index, count)));
340 }
348 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index, count);
349 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index, count)));
350 }
358 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index, count);
359 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index, count)));
360 }
368 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index, count);
369 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index, count)));
370 }
378 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index, count);
379 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index, count)));
380 }
381
388 basic_string(const basic_string<char>& str, xtd::size index, xtd::size count, const allocator_type & allocator) {
390 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
391 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index, count)), allocator);
392 }
399 basic_string(const basic_string<xtd::char16>& str, xtd::size index, xtd::size count, const allocator_type & allocator) {
401 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
402 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index, count)), allocator);
403 }
410 basic_string(const basic_string<xtd::char32>& str, xtd::size index, xtd::size count, const allocator_type & allocator) {
412 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
413 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index, count)), allocator);
414 }
421 basic_string(const basic_string<xtd::char8>& str, xtd::size index, xtd::size count, const allocator_type & allocator) {
423 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
424 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index, count)), allocator);
425 }
432 basic_string(const basic_string<xtd::wchar>& str, xtd::size index, xtd::size count, const allocator_type & allocator) {
434 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
435 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index, count)), allocator);
436 }
437
440 basic_string(basic_string&&) = default;
441
445 basic_string(basic_string&& str, const allocator_type & allocator) noexcept : chars_(std::move(str.chars_)) {}
446
451 basic_string(xtd::size count, char character) : basic_string(std::basic_string<char>(count, character)) {}
456 basic_string(xtd::size count, char character, const allocator_type & allocator) : basic_string(std::basic_string<char>(count, character), allocator) {}
460 basic_string(xtd::size count, xtd::char16 character) : basic_string(std::basic_string<xtd::char16>(count, character)) {}
465 basic_string(xtd::size count, xtd::char16 character, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char16>(count, character), allocator) {}
469 basic_string(xtd::size count, xtd::char32 character) : basic_string(std::basic_string<xtd::char32>(count, character)) {}
474 basic_string(xtd::size count, xtd::char32 character, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char32>(count, character), allocator) {}
478 basic_string(xtd::size count, xtd::char8 character) : basic_string(std::basic_string<xtd::char8>(count, character)) {}
483 basic_string(xtd::size count, xtd::char8 character, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char8>(count, character), allocator) {}
487 basic_string(xtd::size count, xtd::wchar character) : basic_string(std::basic_string<xtd::wchar>(count, character)) {}
493 basic_string(xtd::size count, xtd::wchar character, const allocator_type & allocator) : basic_string(std::basic_string<xtd::wchar>(count, character), allocator) {}
494
498 basic_string(char character, xtd::size count) : basic_string(std::basic_string<char>(count, character)) {}
503 basic_string(char character, xtd::size count, const allocator_type & allocator) : basic_string(std::basic_string<char>(count, character), allocator) {}
507 basic_string(xtd::char16 character, xtd::size count) : basic_string(std::basic_string<xtd::char16>(count, character)) {}
512 basic_string(xtd::char16 character, xtd::size count, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char16>(count, character), allocator) {}
516 basic_string(xtd::char32 character, xtd::size count) : basic_string(std::basic_string<xtd::char32>(count, character)) {}
521 basic_string(xtd::char32 character, xtd::size count, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char32>(count, character), allocator) {}
525 basic_string(xtd::char8 character, xtd::size count) : basic_string(std::basic_string<xtd::char8>(count, character)) {}
530 basic_string(xtd::char8 character, xtd::size count, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char8>(count, character), allocator) {}
534 basic_string(xtd::wchar character, xtd::size count) : basic_string(std::basic_string<xtd::wchar>(count, character)) {}
539 basic_string(xtd::wchar character, xtd::size count, const allocator_type & allocator) : basic_string(std::basic_string<xtd::wchar>(count, character), allocator) {}
540
543 basic_string(const char* str) { // Can't be explicit by design.
545 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str);
546 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str));
547 }
550 basic_string(const xtd::char16 * str) { // Can't be explicit by design.
552 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str);
553 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str));
554 }
557 basic_string(const xtd::char32 * str) { // Can't be explicit by design.
559 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str);
560 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str));
561 }
564 basic_string(const xtd::char8 * str) { // Can't be explicit by design.
566 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str);
567 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str));
568 }
571 basic_string(const xtd::wchar * str) { // Can't be explicit by design.
573 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
574 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
575 }
576
580 basic_string(const char* str, const allocator_type & allocator) {
582 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str, allocator);
583 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str), allocator);
584 }
588 basic_string(const xtd::char16 * str, const allocator_type & allocator) {
590 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str, allocator);
591 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str), allocator);
592 }
596 basic_string(const xtd::char32 * str, const allocator_type & allocator) {
598 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str, allocator);
599 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str), allocator);
600 }
604 basic_string(const xtd::char8 * str, const allocator_type & allocator) {
606 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str, allocator);
607 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str), allocator);
608 }
612 basic_string(const xtd::wchar * str, const allocator_type & allocator) : chars_(allocator) {
614 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
615 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
616 }
617
620 basic_string(const char* str, xtd::size count) {
622 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str, count);
623 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str, count));
624 }
629 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str, count);
630 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str, count));
631 }
636 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str, count);
637 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str, count));
638 }
641 basic_string(const xtd::char8 * str, xtd::size count) {
643 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str, count);
644 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str, count));
645 }
648 basic_string(const xtd::wchar * str, xtd::size count) {
650 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str, count);
651 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str, count));
652 }
653
658 basic_string(const char* str, xtd::size count, const allocator_type & allocator) {
660 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str, count, allocator);
661 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str, count), allocator);
662 }
667 basic_string(const xtd::char16 * str, xtd::size count, const allocator_type & allocator) : chars_(allocator) {
669 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str, count, allocator);
670 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str, count), allocator);
671 }
676 basic_string(const xtd::char32 * str, xtd::size count, const allocator_type & allocator) : chars_(allocator) {
678 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str, count, allocator);
679 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str, count), allocator);
680 }
685 basic_string(const xtd::char8 * str, xtd::size count, const allocator_type & allocator) : chars_(allocator) {
687 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str, count, allocator);
688 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str, count), allocator);
689 }
694 basic_string(const xtd::wchar * str, xtd::size count, const allocator_type & allocator) : chars_(allocator) {
696 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str, count, allocator);
697 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str, count), allocator);
698 }
699
702 basic_string(const std::basic_string<char>& str) noexcept { // Can't be explicit by design.
703 if constexpr(std::is_same_v<char, char_t>) chars_ = str;
704 else chars_ = __xtd_convert_to_string<value_type>(str);
705 }
708 basic_string(const std::basic_string<xtd::char16>& str) noexcept { // Can't be explicit by design.
709 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = str;
710 else chars_ = __xtd_convert_to_string<value_type>(str);
711 }
714 basic_string(const std::basic_string<xtd::char32>& str) noexcept { // Can't be explicit by design.
715 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = str;
716 else chars_ = __xtd_convert_to_string<value_type>(str);
717 }
720 basic_string(const std::basic_string<xtd::char8>& str) noexcept { // Can't be explicit by design.
721 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = str;
722 else chars_ = __xtd_convert_to_string<value_type>(str);
723 }
726 basic_string(const std::basic_string<xtd::wchar>& str) noexcept { // Can't be explicit by design.
727 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = str;
728 else chars_ = __xtd_convert_to_string<value_type>(str);
729 }
730
734 basic_string(const std::basic_string<char>& str, const allocator_type & allocator) noexcept {
735 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str, allocator);
736 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
737 }
741 basic_string(const std::basic_string<xtd::char16>& str, const allocator_type & allocator) noexcept {
742 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str, allocator);
743 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
744 }
748 basic_string(const std::basic_string<xtd::char32>& str, const allocator_type & allocator) noexcept {
749 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str, allocator);
750 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
751 }
755 basic_string(const std::basic_string<xtd::char8>& str, const allocator_type & allocator) noexcept {
756 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str, allocator);
757 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
758 }
762 basic_string(const std::basic_string<xtd::wchar>& str, const allocator_type & allocator) noexcept {
763 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str, allocator);
764 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
765 }
766
770 template<class input_iterator_t>
771 basic_string(input_iterator_t first, input_iterator_t last) : chars_(first, last) {}
776 template<class input_iterator_t>
777 basic_string(input_iterator_t first, input_iterator_t last, const allocator_type & allocator) : chars_(first, last, allocator) {}
778
782 template<class string_view_like_t>
783 explicit constexpr basic_string(const string_view_like_t& string_view) : chars_(string_view) {}
787 template<class string_view_like_t>
788 explicit constexpr basic_string(const string_view_like_t& string_view, const allocator_type & allocator) : chars_(string_view, allocator) {}
794 template<class string_view_like_t>
795 constexpr basic_string(const string_view_like_t& string_view, size_type index, size_type count) : chars_(string_view, index, count) {}
801 template<class string_view_like_t>
802 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) {}
803
806 basic_string(std::initializer_list<char> il) : basic_string(std::basic_string<char>(il)) {}
809 basic_string(std::initializer_list<xtd::char16> il) : basic_string(std::basic_string<xtd::char16>(il)) {}
812 basic_string(std::initializer_list<xtd::char32> il) : basic_string(std::basic_string<xtd::char32>(il)) {}
815 basic_string(std::initializer_list<xtd::char8> il) : basic_string(std::basic_string<xtd::char8>(il)) {}
818 basic_string(std::initializer_list<xtd::wchar> il) : basic_string(std::basic_string<xtd::wchar>(il)) {}
819
823 basic_string(std::initializer_list<char> il, const allocator_type & allocator) : basic_string(std::basic_string<char>(il), allocator) {}
827 basic_string(std::initializer_list<xtd::char16> il, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char16>(il), allocator) {}
831 basic_string(std::initializer_list<xtd::char32> il, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char32>(il), allocator) {}
835 basic_string(std::initializer_list<xtd::char8> il, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char8>(il), allocator) {}
839 basic_string(std::initializer_list<xtd::wchar> il, const allocator_type & allocator) : basic_string(std::basic_string<xtd::wchar>(il), allocator) {}
841
843
853 const_pointer c_str() const noexcept {return chars_.c_str();}
854
857 const base_type & chars() const noexcept {return chars_;}
858
861 base_type & chars() noexcept {return chars_;}
862
866 virtual size_type count() const noexcept {return chars_.size();}
867
875 const_pointer data() const noexcept {return chars_.data();}
876
879 virtual bool empty() const noexcept {return length() == 0;}
880
884 virtual size_type length() const noexcept {return chars_.size();}
885
889 virtual size_type size() const noexcept {return chars_.size();}
891
893
913 int32 compare(const basic_string & str) const {return chars_.compare(str);}
935 int32 compare(size_type pos1, size_type count1, const basic_string & str) const {return chars_.compare(pos1, count1, str);}
959 int32 compare(size_type pos1, size_type count1, const basic_string & str, size_type pos2) const {return chars_.compare(pos1, count1, str, pos2);}
984 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);}
1003 int32 compare(const_pointer s) const {return chars_.compare(s);}
1025 int32 compare(size_type pos1, size_type count1, const_pointer s) const {return chars_.compare(pos1, count1, s);}
1048 int32 compare(size_type pos1, size_type count1, const_pointer s, size_type count2) const {return chars_.compare(pos1, count1, s, count2);}
1049
1059 int32 compare_to(const object & value) const {
1061 return compare_to(static_cast<const basic_string&>(value));
1062 }
1063
1071 int32 compare_to(const basic_string & value) const noexcept override {return chars_.compare(value.chars_);}
1072
1076 virtual bool contains(value_type value) const noexcept {return find(value) != npos;}
1080 virtual bool contains(const basic_string & value) const noexcept {return find(value) != npos;}
1081
1085 bool equals(const object & obj) const noexcept override {return dynamic_cast<const basic_string*>(&obj) && equals(static_cast<const basic_string&>(obj));}
1090 bool equals(const basic_string & value) const noexcept override {return equals(value, false);}
1096 bool equals(const basic_string & value, bool ignore_case) const noexcept {
1097 if (ignore_case) return to_upper().chars_ == value.to_upper().chars_;
1098 return chars_ == value.chars_;
1099 }
1100
1104 bool ends_with(value_type value) const noexcept {return ends_with(value, false);}
1109 bool ends_with(value_type value, bool ignore_case) const noexcept {
1110 if (ignore_case) return to_lower().rfind(static_cast<value_type>(tolower(value))) == length() - 1;
1111 return rfind(value) == length() - 1;
1112 }
1113
1116 bool ends_with(const basic_string & value) const noexcept {return ends_with(value, xtd::string_comparison::ordinal);}
1121 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);}
1126 bool ends_with(const basic_string & value, xtd::string_comparison comparison_type) const noexcept {
1127 if (comparison_type == xtd::string_comparison::ordinal_ignore_case) return to_lower().rfind(value.to_lower()) + value.to_lower().length() == length();
1128 return rfind(value) + value.length() == length();
1129 }
1130
1134 size_type find(const basic_string & str) const {return chars_.find(str);}
1140 size_type find(const basic_string & str, size_type pos) const {return chars_.find(str, pos);}
1148 size_type find(const_pointer s, size_type pos, size_type count) const {return chars_.find(s, pos, count);}
1154 size_type find(const_pointer s) const {return chars_.find(s);}
1161 size_type find(const_pointer s, size_type pos) const {return chars_.find(s, pos);}
1166 size_type find(value_type ch) const {return chars_.find(ch);}
1172 size_type find(value_type ch, size_type pos) const {return chars_.find(ch, pos);}
1173
1178 size_type find_first_of(const basic_string & str) const {return chars_.find_first_of(str);}
1184 size_type find_first_of(const basic_string & str, size_type pos) const {return chars_.find_first_of(str, pos);}
1192 size_type find_first_of(const_pointer s, size_type pos, size_type count) const {return chars_.find_first_of(s, pos, count);}
1198 size_type find_first_of(const_pointer s) const {return chars_.find_first_of(s);}
1205 size_type find_first_of(const_pointer s, size_type pos) const {return chars_.find_first_of(s, pos);}
1210 size_type find_first_of(char_t ch) const {return chars_.find_first_of(ch);}
1216 size_type find_first_of(char_t ch, size_type pos) const {return chars_.find_first_of(ch, pos);}
1217
1222 size_type find_first_not_of(const basic_string & str) const {return chars_.find_first_not_of(str);}
1228 size_type find_first_not_of(const basic_string & str, size_type pos) const {return chars_.find_first_not_of(str, pos);}
1236 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);}
1242 size_type find_first_not_of(const_pointer s) const {return chars_.find_first_not_of(s);}
1249 size_type find_first_not_of(const_pointer s, size_type pos) const {return chars_.find_first_not_of(s, pos);}
1254 size_type find_first_not_of(char_t ch) const {return chars_.find_first_not_of(ch);}
1260 size_type find_first_not_of(char_t ch, size_type pos) const {return chars_.find_first_not_of(ch, pos);}
1261
1266 size_type find_last_of(const basic_string & str) const {return chars_.find_last_of(str);}
1272 size_type find_last_of(const basic_string & str, size_type pos) const {return chars_.find_last_of(str, pos);}
1280 size_type find_last_of(const_pointer s, size_type pos, size_type count) const {return chars_.find_last_of(s, pos, count);}
1286 size_type find_last_of(const_pointer s) const {return chars_.find_last_of(s);}
1293 size_type find_last_of(const_pointer s, size_type pos) const {return chars_.find_last_of(s, pos);}
1298 size_type find_last_of(char_t ch) const {return chars_.find_last_of(ch);}
1304 size_type find_last_of(char_t ch, size_type pos) const {return chars_.find_last_of(ch, pos);}
1305
1310 size_type find_last_not_of(const basic_string & str) const {return chars_.find_last_not_of(str);}
1316 size_type find_last_not_of(const basic_string & str, size_type pos) const {return chars_.find_last_not_of(str, pos);}
1324 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);}
1330 size_type find_last_not_of(const_pointer s) const {return chars_.find_last_not_of(s);}
1337 size_type find_last_not_of(const_pointer s, size_type pos) const {return chars_.find_last_not_of(s, pos);}
1342 size_type find_last_not_of(char_t ch) const {return chars_.find_last_not_of(ch);}
1348 size_type find_last_not_of(char_t ch, size_type pos) const {return chars_.find_last_not_of(ch, pos);}
1349
1352 allocator_type get_allocator() const {return chars_.get_allocator();}
1353
1356 virtual const base_type & get_base_type() const noexcept {return chars_;}
1357
1360 xtd::size get_hash_code() const noexcept override {return xtd::hash_code::combine(chars_);}
1361
1362 enumerator_type get_enumerator() const noexcept override {
1363 class basic_string_enumerator : public xtd::collections::generic::ienumerator<value_type> {
1364 public:
1365 explicit basic_string_enumerator(const basic_string & chars) : chars_(chars) {}
1366
1367 const value_type & current() const override {return chars_[index_];}
1368
1369 bool move_next() override {return ++index_ < chars_.length();}
1370
1371 void reset() override {index_ = basic_string::npos;}
1372
1373 protected:
1374 const basic_string& chars_;
1375 xtd::size index_ = basic_string::npos;
1376 };
1378 }
1379
1383 xtd::size index_of(const basic_string & value) const noexcept {return index_of(value, 0, length());}
1388 xtd::size index_of(const basic_string & value, xtd::size start_index) const {return index_of(value, start_index, length() - start_index);}
1395 xtd::size index_of(const basic_string & value, xtd::size start_index, xtd::size count) const {
1397 auto result = find(value, start_index);
1398 return result > start_index + count ? npos : result;
1399 }
1400
1403 xtd::size index_of(value_type value) const noexcept {return index_of(value, 0, length());}
1408 xtd::size index_of(value_type value, xtd::size start_index) const {return index_of(value, start_index, length() - start_index);}
1417 auto result = find(value, start_index);
1418 return result > start_index + count ? npos : result;
1419 }
1420
1424 xtd::size index_of_any(const xtd::array<value_type>& values) const noexcept;
1430 xtd::size index_of_any(const xtd::array<value_type>& values, xtd::size start_index) const;
1439 xtd::size index_of_any(const std::initializer_list<value_type>& values) const noexcept;
1440 xtd::size index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index) const;
1441 xtd::size index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index, xtd::size count) const;
1443
1450 basic_string insert(xtd::size start_index, const basic_string & value) const {
1452 auto result = self_;
1453 result.chars_.insert(start_index, value);
1454 return result;
1455 }
1456
1460 xtd::size last_index_of(const basic_string & value) const noexcept {return last_index_of(value, 0, length());}
1466 xtd::size last_index_of(const basic_string & value, xtd::size start_index) const {return last_index_of(value, start_index, length() - start_index);}
1473 xtd::size last_index_of(const basic_string & value, xtd::size start_index, xtd::size count) const {
1475 auto result = rfind(value, start_index + count - value.length());
1476 return result < start_index ? npos : result;
1477 }
1478
1481 xtd::size last_index_of(value_type value) const noexcept {return last_index_of(value, 0, length());}
1487 xtd::size last_index_of(value_type value, xtd::size start_index) const {return last_index_of(value, start_index, length() - start_index);}
1497 auto result = rfind(value, start_index + count - 1);
1498 return result < start_index ? npos : result;
1499 }
1500
1517 xtd::size last_index_of_any(const std::initializer_list<value_type>& values) const noexcept;
1518 xtd::size last_index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index) const;
1519 xtd::size last_index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index, xtd::size count) const;
1521
1527 basic_string pad_left(xtd::size total_width) const noexcept {return pad_left(total_width, ' ');}
1534 basic_string pad_left(xtd::size total_width, char32 padding_char) const noexcept {return total_width < length() ? self_ : basic_string(total_width - length(), padding_char) + self_;}
1535
1541 basic_string pad_right(xtd::size total_width) const noexcept {return pad_right(total_width, ' ');}
1548 basic_string pad_right(xtd::size total_width, char32 padding_char) const noexcept {return total_width < length() ? self_ : self_ + basic_string(total_width - length(), padding_char);}
1549
1554 basic_string quoted() const {return quoted('"', '\\');}
1559 basic_string quoted(value_type delimiter) const {return quoted(delimiter, '\\');}
1566 std::wstringstream ss;
1567 if constexpr(std::is_same_v<xtd::wchar, value_type>) ss << std::quoted(chars_, delimiter, escape);
1568 else ss << std::quoted(__xtd_convert_to_string<xtd::wchar>(chars_), static_cast<xtd::wchar>(delimiter), static_cast<xtd::wchar>(escape));
1569 return ss.str();
1570 }
1571
1575 basic_string remove(xtd::size start_index) const {return remove(start_index, length() - start_index);}
1582 auto result = self_;
1583 result.chars_.erase(start_index, count);
1584 return result;
1585 }
1586
1591 basic_string replace(value_type old_char, value_type new_char) const noexcept {return replace(string(1, old_char), string(1, new_char));}
1597 basic_string replace(const basic_string & old_string, const basic_string & new_string) const noexcept {
1598 auto result = self_;
1599 auto old_size = old_string.length();
1600 auto new_size = new_string.length();
1601 auto index = xtd::size {0};
1602 while (true) {
1603 index = result.find(old_string, index);
1604 if (index == npos) break;
1605 if (old_size == new_size) result.chars_.replace(index, old_size, new_string);
1606 else {
1607 result.chars_.erase(index, old_string.length());
1608 result.chars_.insert(index, new_string);
1609 }
1610 index += new_string.length();
1611 }
1612 return result;
1613 }
1614
1618 size_type rfind(const basic_string & str) const {return chars_.rfind(str);}
1624 size_type rfind(const basic_string & str, size_type pos) const {return chars_.rfind(str, pos);}
1632 size_type rfind(const_pointer s, size_type pos, size_type count) const {return chars_.rfind(s, pos, count);}
1638 size_type rfind(const_pointer s) const {return chars_.rfind(s);}
1645 size_type rfind(const_pointer s, size_type pos) const {return chars_.rfind(s, pos);}
1650 size_type rfind(value_type ch) const {return chars_.rfind(ch);}
1656 size_type rfind(value_type ch, size_type pos) const {return chars_.rfind(ch, pos);}
1657
1662 xtd::array<basic_string> split() const noexcept;
1668 xtd::array<basic_string> split(value_type separator) const noexcept;
1685 xtd::array<basic_string> split(value_type separator, xtd::string_split_options options) const noexcept;
1694 xtd::array<basic_string> split(value_type separator, xtd::size count) const noexcept;
1706 xtd::array<basic_string> split(value_type separator, xtd::size count, xtd::string_split_options options) const noexcept;
1712 xtd::array<basic_string> split(const xtd::array<value_type>& separators) const noexcept;
1729 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::string_split_options options) const noexcept;
1738 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::size count) const noexcept;
1750 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::size count, xtd::string_split_options options) const noexcept;
1751
1756 bool starts_with(value_type value) const noexcept {return starts_with(value, false);}
1762 bool starts_with(value_type value, bool ignore_case) const noexcept {
1763 if (ignore_case) return to_lower().find(static_cast<value_type>(tolower(value))) == 0;
1764 return find(value) == 0;
1765 }
1770 bool starts_with(const basic_string & value) const noexcept {return starts_with(value, string_comparison::ordinal);}
1776 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);}
1781 bool starts_with(const basic_string & value, xtd::string_comparison comparison_type) const noexcept {
1782 if (comparison_type == xtd::string_comparison::ordinal_ignore_case) return to_lower().find(value.to_lower()) == 0;
1783 return find(value) == 0;
1784 }
1785
1790 basic_string substr() const {return chars_.substr();}
1796 basic_string substr(size_type pos) const {
1798 return chars_.substr(pos);
1799 }
1806 basic_string substr(size_type pos, size_type count) const {
1808 return chars_.substr(pos, count);
1809 }
1810
1816 basic_string substring(xtd::size start_index) const {
1818 return substr(start_index);
1819 }
1825 basic_string substring(xtd::size start_index, xtd::size length) const {
1826 if (start_index > self_.length() || start_index + length > self_.length()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range);
1827 return substr(start_index, length);
1828 }
1829
1832 xtd::array<value_type> to_array() const noexcept;
1836 xtd::array<value_type> to_array(xtd::size start_index) const;
1841 xtd::array<value_type> to_array(xtd::size start_index, xtd::size length) const;
1842
1845 xtd::array<value_type> to_char_array() const noexcept;
1850 xtd::array<value_type> to_char_array(xtd::size start_index, xtd::size length) const;
1851
1854 basic_string to_lower() const noexcept {
1855 auto result = basic_string::empty_string;
1856 std::for_each(chars_.begin(), chars_.end(), [&](auto c) {result += static_cast<value_type>(std::tolower(c));});
1857 return result;
1858 }
1859
1863 basic_string<char> to_string() const noexcept override {
1864 if constexpr(std::is_same_v<char, char_t>) return chars_;
1865 else return __xtd_convert_to_string<char>(chars_);
1866 }
1867
1870 basic_string to_title_case() const noexcept;
1871
1874 basic_string<xtd::char16> to_u16string() const noexcept {
1875 if constexpr(std::is_same_v<xtd::char16, char_t>) return chars_;
1876 else return __xtd_convert_to_string<xtd::char16>(chars_);
1877 }
1878
1881 basic_string<xtd::char32> to_u32string() const noexcept {
1882 if constexpr(std::is_same_v<xtd::char32, char_t>) return chars_;
1883 else return __xtd_convert_to_string<xtd::char32>(chars_);
1884 }
1885
1888 basic_string<xtd::char8> to_u8string() const noexcept {
1889 if constexpr(std::is_same_v<xtd::char8, char_t>) return chars_;
1890 else return __xtd_convert_to_string<xtd::char8>(chars_);
1891 }
1892
1895 basic_string to_upper() const noexcept {
1896 auto result = basic_string::empty_string;
1897 std::for_each(chars_.begin(), chars_.end(), [&](auto c) {result += static_cast<value_type>(std::toupper(c));});
1898 return result;
1899 }
1900
1903 basic_string<xtd::wchar> to_wstring() const noexcept {
1904 if constexpr(std::is_same_v<xtd::wchar, char_t>) return chars_;
1905 else return __xtd_convert_to_string<xtd::wchar>(chars_);
1906 }
1907
1912 basic_string trim() const noexcept {return trim(default_trim_chars);}
1917 basic_string trim(value_type trim_char) const noexcept;
1922 basic_string trim(const xtd::array<value_type>& trim_chars) const noexcept;
1923
1928 basic_string trim_end() const noexcept {return trim_end(default_trim_chars);}
1933 basic_string trim_end(value_type trim_char) const noexcept;
1938 basic_string trim_end(const xtd::array<value_type>& trim_chars) const noexcept;
1939
1944 basic_string trim_start() const noexcept {return trim_start(default_trim_chars);}
1949 basic_string trim_start(value_type trim_char) const noexcept;
1954 basic_string trim_start(const xtd::array<value_type>& trim_chars) const noexcept;
1956
1958
1969 static int32 compare(const basic_string & str_a, const basic_string & str_b) noexcept {return compare(str_a, str_b, false);}
1980 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);}
1991 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);}
2004 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);}
2018 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);}
2032 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));}
2033
2040 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;}
2047 template<class object_a_t, class object_b_t, class object_c_t, class object_d_t>
2048 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);}
2054 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;}
2060 template<class object_a_t, class object_b_t, class object_c_t>
2061 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);}
2066 static basic_string concat(const basic_string & str_a, const basic_string & str_b) noexcept {return str_a + str_b;}
2071 template<class object_a_t, class object_b_t>
2072 static basic_string concat(object_a_t obj_a, object_b_t obj_b) noexcept {return format("{}{}", obj_a, obj_b);}
2076 static basic_string concat(const xtd::array<basic_string>& values) noexcept;
2078 static basic_string concat(const xtd::array<const_pointer>& values) noexcept;
2079 template<class other_char_t>
2080 static basic_string concat(const xtd::array<const other_char_t*>& values) noexcept;
2081 static basic_string concat(const std::initializer_list<basic_string>& values) noexcept {
2082 auto result = basic_string::empty_string;
2083 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2084 return result;
2085 }
2086 static basic_string concat(const std::initializer_list<const_pointer>& values) noexcept {
2087 auto result = basic_string::empty_string;
2088 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2089 return result;
2090 }
2091 template<class other_char_t>
2092 static basic_string concat(const std::initializer_list<const other_char_t*>& values) noexcept {
2093 auto result = basic_string::empty_string;
2094 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2095 return result;
2096 }
2101 template<class object_t>
2102 static basic_string concat(const xtd::array<object_t>& args) noexcept;
2104 template<class object_t>
2105 static basic_string concat(const std::initializer_list<object_t>& args) noexcept {
2106 basic_string result;
2107 for (const auto& arg : args)
2108 result += format("{}", arg);
2109 return result;
2110 }
2115 template<class value_t>
2116 static basic_string concat(value_t value) noexcept {
2117 return format("{}", value);
2118 }
2119
2140 static basic_string demangle(const basic_string & name) {
2141 if constexpr(std::is_same_v<char, char_t>) return __xtd_demangle(name.chars());
2142 else return __xtd_demangle(__xtd_convert_to_string<char>(name.chars()));
2143 }
2144
2150 static bool equals(const basic_string & a, const basic_string & b) noexcept{return a.equals(b);}
2156 template<class char_a_t, class char_b_t>
2157 static bool equals(const char_a_t* a, const char_b_t* b) noexcept{return basic_string {a}.equals(basic_string {b});}
2158
2165 static bool equals(const basic_string & a, const basic_string & b, bool ignore_case) noexcept {return a.equals(b, ignore_case);}
2172 template<class char_a_t, class char_b_t>
2173 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);}
2174
2181 template<class ...args_t>
2182 static basic_string format(const basic_string<char>& fmt, args_t&& ... args);
2183
2187 static bool is_empty(const xtd::basic_string<value_type, traits_type, allocator_type>& string) noexcept {return !string.length();}
2188
2195 template<class collection_t>
2196 static basic_string join(const basic_string separator, const collection_t& values) noexcept {
2197 xtd::size i = 0;
2198 basic_string result;
2199 for (const auto& item : values)
2200 result += format("{}{}", (i++ != 0 ? separator : basic_string {}), item);
2201 return result;
2202 }
2210 template<class collection_t>
2211 static basic_string join(const basic_string & separator, const collection_t& values, xtd::size index) {return join(separator, values, index, values.size() - index);}
2220 template<class collection_t>
2221 static basic_string join(const basic_string & separator, const collection_t& values, xtd::size index, xtd::size count) {
2222 if (index > values.size() || index + count > values.size()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range);
2223 xtd::size i = 0;
2224 basic_string result;
2225 for (const auto& item : values) {
2226 if (i >= index) result += format("{}{}", (i != index ? separator : basic_string {}), item);
2227 if (++i >= index + count) break;
2228 }
2229 return result;
2230 }
2231
2233 template<class value_t>
2234 static basic_string join(const basic_string & separator, const std::initializer_list<value_t>& values) noexcept;
2235 template<class value_t>
2236 static basic_string join(const basic_string & separator, const std::initializer_list<value_t>& values, xtd::size index);
2237 template<class value_t>
2238 static basic_string join(const basic_string & separator, const std::initializer_list<value_t>& values, xtd::size index, xtd::size count);
2240
2244 template<class value_t>
2245 static value_t parse(const basic_string & str) {
2246 if constexpr(std::is_same_v<char, char_t>) return xtd::parse<value_t>(str.chars());
2247 else return xtd::parse<value_t>(__xtd_convert_to_string<char>(str.chars()));
2248 }
2249
2309 template<class ...args_t>
2310 static basic_string sprintf(const basic_string & fmt, args_t&& ... args) noexcept {return __sprintf(fmt.chars().c_str(), convert_param(std::forward<args_t>(args)) ...);}
2311
2316 template<class value_t>
2317 static bool try_parse(const basic_string & str, value_t& value) noexcept {
2318 try {
2319 value = parse<value_t>(str);
2320 return true;
2321 } catch (...) {
2322 return false;
2323 }
2324 }
2326
2328
2334 const_reference operator [](xtd::size index) const {
2336 return chars_[index == epos ? length() - 1 : index];
2337 }
2338
2341 operator const base_type & () const noexcept {return chars_;}
2342
2346 basic_string& operator =(const basic_string<char>& str) noexcept {
2347 if constexpr(std::is_same<char_t, char>::value) chars_ = str.chars_;
2348 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2349 return self_;
2350 }
2354 basic_string& operator =(const basic_string<xtd::char16>& str) noexcept {
2355 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str.chars_;
2356 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2357 return self_;
2358 }
2362 basic_string& operator =(const basic_string<xtd::char32>& str) noexcept {
2363 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str.chars_;
2364 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2365 return self_;
2366 }
2370 basic_string& operator =(const basic_string<xtd::char8>& str) noexcept {
2371 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str.chars_;
2372 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2373 return self_;
2374 }
2378 basic_string& operator =(const basic_string<xtd::wchar>& str) noexcept {
2379 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str.chars_;
2380 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2381 return self_;
2382 }
2383
2387 basic_string& operator =(basic_string<char>&& str) noexcept {
2388 if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str.chars_);
2389 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2390 return self_;
2391 }
2395 basic_string& operator =(basic_string<xtd::char16>&& str) noexcept {
2396 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str.chars_);
2397 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2398 return self_;
2399 }
2403 basic_string& operator =(basic_string<xtd::char32>&& str) noexcept {
2404 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str.chars_);
2405 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2406 return self_;
2407 }
2411 basic_string& operator =(basic_string<xtd::char8>&& str) noexcept {
2412 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str.chars_);
2413 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2414 return self_;
2415 }
2419 basic_string& operator =(basic_string<xtd::wchar>&& str) noexcept {
2420 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str.chars_);
2421 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2422 return self_;
2423 }
2424
2428 basic_string& operator =(const std::basic_string<char>& str) noexcept {
2429 if constexpr(std::is_same<char_t, char>::value) chars_ = str;
2430 else chars_ = __xtd_convert_to_string<value_type>(str);
2431 return self_;
2432 }
2436 basic_string& operator =(const std::basic_string<xtd::char16>& str) noexcept {
2437 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str;
2438 else chars_ = __xtd_convert_to_string<value_type>(str);
2439 return self_;
2440 }
2444 basic_string& operator =(const std::basic_string<xtd::char32>& str) noexcept {
2445 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str;
2446 else chars_ = __xtd_convert_to_string<value_type>(str);
2447 return self_;
2448 }
2452 basic_string& operator =(const std::basic_string<xtd::char8>& str) noexcept {
2453 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str;
2454 else chars_ = __xtd_convert_to_string<value_type>(str);
2455 return self_;
2456 }
2460 basic_string& operator =(const std::basic_string<xtd::wchar>& str) noexcept {
2461 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str;
2462 else chars_ = __xtd_convert_to_string<value_type>(str);
2463 return self_;
2464 }
2465
2469 basic_string& operator =(std::basic_string<char>&& str) noexcept {
2470 if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str);
2471 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2472 return self_;
2473 }
2477 basic_string& operator =(std::basic_string<xtd::char16>&& str) noexcept {
2478 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str);
2479 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2480 return self_;
2481 }
2485 basic_string& operator =(std::basic_string<xtd::char32>&& str) noexcept {
2486 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str);
2487 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2488 return self_;
2489 }
2493 basic_string& operator =(std::basic_string<xtd::char8>&& str) noexcept {
2494 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str);
2495 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2496 return self_;
2497 }
2501 basic_string& operator =(std::basic_string<xtd::wchar>&& str) noexcept {
2502 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str);
2503 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2504 return self_;
2505 }
2506
2511 basic_string& operator =(const char* str) {
2513 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str);
2514 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str));
2515 return self_;
2516 }
2521 basic_string& operator =(const xtd::char16 * str) {
2523 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str);
2524 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str));
2525 return self_;
2526 }
2531 basic_string& operator =(const xtd::char32 * str) {
2533 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str);
2534 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str));
2535 return self_;
2536 }
2541 basic_string& operator =(const xtd::char8 * str) {
2543 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str);
2544 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str));
2545 return self_;
2546 }
2551 basic_string& operator =(const xtd::wchar * str) {
2553 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
2554 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
2555 return self_;
2556 }
2557
2561 basic_string& operator =(char character) {
2562 self_ = basic_string(1, character);
2563 return self_;
2564 }
2568 basic_string& operator =(xtd::char16 character) {
2569 self_ = basic_string(1, character);
2570 return self_;
2571 }
2575 basic_string& operator =(xtd::char32 character) {
2576 self_ = basic_string(1, character);
2577 return self_;
2578 }
2582 basic_string& operator =(xtd::char8 character) {
2583 self_ = basic_string(1, character);
2584 return self_;
2585 }
2589 basic_string& operator =(xtd::wchar character) {
2590 self_ = basic_string(1, character);
2591 return self_;
2592 }
2593
2597 basic_string& operator =(const std::initializer_list<char>& il) {
2598 self_ = basic_string(il);
2599 return self_;
2600 }
2604 basic_string& operator =(const std::initializer_list<xtd::char16>& il) {
2605 self_ = basic_string(il);
2606 return self_;
2607 }
2611 basic_string& operator =(const std::initializer_list<xtd::char32>& il) {
2612 self_ = basic_string(il);
2613 return self_;
2614 }
2618 basic_string& operator =(const std::initializer_list<xtd::char8>& il) {
2619 self_ = basic_string(il);
2620 return self_;
2621 }
2625 basic_string& operator =(const std::initializer_list<xtd::wchar>& il) {
2626 self_ = basic_string(il);
2627 return self_;
2628 }
2629
2633 basic_string & operator +=(const basic_string<char>& str) {
2634 if constexpr(std::is_same_v<char, char_t>) chars_ += str.chars_;
2635 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2636 return self_;
2637 }
2641 basic_string & operator +=(const basic_string<xtd::char16>& str) {
2642 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += str.chars_;
2643 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2644 return self_;
2645 }
2649 basic_string & operator +=(const basic_string<xtd::char32>& str) {
2650 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += str.chars_;
2651 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2652 return self_;
2653 }
2657 basic_string & operator +=(const basic_string<xtd::char8>& str) {
2658 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += str.chars_;
2659 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2660 return self_;
2661 }
2665 basic_string & operator +=(const basic_string<xtd::wchar>& str) {
2666 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += str.chars_;
2667 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2668 return self_;
2669 }
2670
2674 basic_string & operator +=(basic_string<char>&& str) {
2675 if constexpr(std::is_same_v<char, char_t>) chars_ += std::move(str.chars_);
2676 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2677 return self_;
2678 }
2682 basic_string & operator +=(basic_string<xtd::char16>&& str) {
2683 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += std::move(str.chars_);
2684 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2685 return self_;
2686 }
2690 basic_string & operator +=(basic_string<xtd::char32>&& str) {
2691 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += std::move(str.chars_);
2692 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2693 return self_;
2694 }
2698 basic_string & operator +=(basic_string<xtd::char8>&& str) {
2699 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += std::move(str.chars_);
2700 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2701 return self_;
2702 }
2706 basic_string & operator +=(basic_string<xtd::wchar>&& str) {
2707 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += std::move(str.chars_);
2708 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2709 return self_;
2710 }
2711
2715 basic_string & operator +=(const std::basic_string<char>& str) {
2716 if constexpr(std::is_same_v<char, char_t>) chars_ += str;
2717 else chars_ += __xtd_convert_to_string<value_type>(str);
2718 return self_;
2719 }
2723 basic_string & operator +=(const std::basic_string<xtd::char16>& str) {
2724 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += str;
2725 else chars_ += __xtd_convert_to_string<value_type>(str);
2726 return self_;
2727 }
2731 basic_string & operator +=(const std::basic_string<xtd::char32>& str) {
2732 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += str;
2733 else chars_ += __xtd_convert_to_string<value_type>(str);
2734 return self_;
2735 }
2739 basic_string & operator +=(const std::basic_string<xtd::char8>& str) {
2740 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += str;
2741 else chars_ += __xtd_convert_to_string<value_type>(str);
2742 return self_;
2743 }
2747 basic_string & operator +=(const std::basic_string<xtd::wchar>& str) {
2748 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += str;
2749 else chars_ += __xtd_convert_to_string<value_type>(str);
2750 return self_;
2751 }
2752
2756 basic_string & operator +=(const char* str) {
2757 chars_ += basic_string(str).chars_;
2758 return self_;
2759 }
2763 basic_string & operator +=(const xtd::char16 * str) {
2764 chars_.append(basic_string(str).chars_); return self_;
2765 }
2769 basic_string & operator +=(const xtd::char32 * str) {
2770 chars_ += basic_string(str).chars_;
2771 return self_;
2772 }
2776 basic_string & operator +=(const xtd::char8 * str) {
2777 chars_ += basic_string(str).chars_;
2778 return self_;
2779 }
2783 basic_string & operator +=(const xtd::wchar * str) {
2784 chars_ += basic_string(str).chars_;
2785 return self_;
2786 }
2790 basic_string & operator +=(char ch) {
2791 chars_ += basic_string(1, ch).chars_;
2792 return self_;
2793 }
2797 basic_string & operator +=(xtd::char16 ch) {
2798 chars_ += basic_string(1, ch).chars_;
2799 return self_;
2800 }
2804 basic_string & operator +=(xtd::char32 ch) {
2805 chars_ += basic_string(1, ch).chars_;
2806 return self_;
2807 }
2811 basic_string & operator +=(xtd::char8 ch) {
2812 chars_ += basic_string(1, ch).chars_;
2813 return self_;
2814 }
2818 basic_string & operator +=(xtd::wchar ch) {
2819 chars_ += basic_string(1, ch).chars_;
2820 return self_;
2821 }
2822
2827 friend basic_string operator +(const basic_string & lhs, const basic_string<char>& rhs) {
2828 auto result = lhs;
2829 result += rhs;
2830 return result;
2831 }
2836 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char16>& rhs) {
2837 auto result = lhs;
2838 result += rhs;
2839 return result;
2840 }
2845 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char32>& rhs) {
2846 auto result = lhs;
2847 result += rhs;
2848 return result;
2849 }
2854 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char8>& rhs) {
2855 auto result = lhs;
2856 result += rhs;
2857 return result;
2858 }
2863 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::wchar>& rhs) {
2864 auto result = lhs;
2865 result += rhs;
2866 return result;
2867 }
2868
2873 friend basic_string operator +(basic_string&& lhs, basic_string<char>&& rhs) {
2874 auto result = std::move(lhs);
2875 result += std::move(rhs);
2876 return result;
2877 }
2882 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char16>&& rhs) {
2883 auto result = std::move(lhs);
2884 result += std::move(rhs);
2885 return result;
2886 }
2891 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char32>&& rhs) {
2892 auto result = std::move(lhs);
2893 result += std::move(rhs);
2894 return result;
2895 }
2900 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char8>&& rhs) {
2901 auto result = std::move(lhs);
2902 result += std::move(rhs);
2903 return result;
2904 }
2909 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::wchar>&& rhs) {
2910 auto result = std::move(lhs);
2911 result += std::move(rhs);
2912 return result;
2913 }
2914
2919 friend basic_string operator +(basic_string&& lhs, const basic_string<char>& rhs) {
2920 auto result = std::move(lhs);
2921 result += rhs;
2922 return result;
2923 }
2928 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char16>& rhs) {
2929 auto result = std::move(lhs);
2930 result += rhs;
2931 return result;
2932 }
2937 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char32>& rhs) {
2938 auto result = std::move(lhs);
2939 result += rhs;
2940 return result;
2941 }
2946 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char8>& rhs) {
2947 auto result = std::move(lhs);
2948 result += rhs;
2949 return result;
2950 }
2955 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::wchar>& rhs) {
2956 auto result = std::move(lhs);
2957 result += rhs;
2958 return result;
2959 }
2960
2965 friend basic_string operator +(const basic_string & lhs, basic_string<char>&& rhs) {
2966 auto result = lhs;
2967 result += std::move(rhs);
2968 return result;
2969 }
2974 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char16>&& rhs) {
2975 auto result = lhs;
2976 result += std::move(rhs);
2977 return result;
2978 }
2983 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char32>&& rhs) {
2984 auto result = lhs;
2985 result += std::move(rhs);
2986 return result;
2987 }
2992 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char8>&& rhs) {
2993 auto result = lhs;
2994 result += std::move(rhs);
2995 return result;
2996 }
3001 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::wchar>&& rhs) {
3002 auto result = lhs;
3003 result += std::move(rhs);
3004 return result;
3005 }
3006
3011 friend basic_string operator +(const basic_string & lhs, const std::basic_string<char>& rhs) {
3012 auto result = lhs;
3013 result += rhs;
3014 return result;
3015 }
3020 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char16>& rhs) {
3021 auto result = lhs;
3022 result += rhs;
3023 return result;
3024 }
3029 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char32>& rhs) {
3030 auto result = lhs;
3031 result += rhs;
3032 return result;
3033 }
3038 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char8>& rhs) {
3039 auto result = lhs;
3040 result += rhs;
3041 return result;
3042 }
3047 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::wchar>& rhs) {
3048 auto result = lhs;
3049 result += rhs;
3050 return result;
3051 }
3052
3057 friend basic_string operator +(const std::basic_string<char>& lhs, const basic_string & rhs) {
3058 auto result = lhs;
3059 if constexpr(std::is_same_v<char, char_t>) result += rhs.chars();
3060 else result += __xtd_convert_to_string<char>(rhs.chars());
3061 return result;
3062 }
3067 friend basic_string operator +(const std::basic_string<xtd::char16>& lhs, const basic_string & rhs) {
3068 auto result = lhs;
3069 if constexpr(std::is_same_v<xtd::char16, char_t>) result += rhs.chars();
3070 else result += __xtd_convert_to_string<xtd::char16>(rhs.chars());
3071 return result;
3072 }
3077 friend basic_string operator +(const std::basic_string<xtd::char32>& lhs, const basic_string & rhs) {
3078 auto result = lhs;
3079 if constexpr(std::is_same_v<xtd::char32, char_t>) result += rhs.chars();
3080 else result += __xtd_convert_to_string<xtd::char32>(rhs.chars());
3081 return result;
3082 }
3087 friend basic_string operator +(const std::basic_string<xtd::char8>& lhs, const basic_string & rhs) {
3088 auto result = lhs;
3089 if constexpr(std::is_same_v<xtd::char8, char_t>) result += rhs.chars();
3090 else result += __xtd_convert_to_string<xtd::char8>(rhs.chars());
3091 return result;
3092 }
3097 friend basic_string operator +(const std::basic_string<xtd::wchar>& lhs, const basic_string & rhs) {
3098 auto result = lhs;
3099 if constexpr(std::is_same_v<xtd::wchar, char_t>) result += rhs.chars();
3100 else result += __xtd_convert_to_string<xtd::wchar>(rhs.chars());
3101 return result;
3102 }
3103
3108 friend basic_string operator +(const basic_string & lhs, const char* rhs) {
3109 auto result = lhs;
3110 result += rhs;
3111 return result;
3112 }
3117 friend basic_string operator +(const basic_string & lhs, const xtd::char16 * rhs) {
3118 auto result = lhs;
3119 result += rhs;
3120 return result;
3121 }
3126 friend basic_string operator +(const basic_string & lhs, const xtd::char32 * rhs) {
3127 auto result = lhs;
3128 result += rhs;
3129 return result;
3130 }
3135 friend basic_string operator +(const basic_string & lhs, const xtd::char8 * rhs) {
3136 auto result = lhs;
3137 result += rhs;
3138 return result;
3139 }
3144 friend basic_string operator +(const basic_string & lhs, const xtd::wchar * rhs) {
3145 auto result = lhs;
3146 result += rhs;
3147 return result;
3148 }
3149
3154 friend basic_string operator +(basic_string&& lhs, const char* rhs) {
3155 auto result = std::move(lhs);
3156 result += rhs;
3157 return result;
3158 }
3163 friend basic_string operator +(basic_string&& lhs, const xtd::char16 * rhs) {
3164 auto result = std::move(lhs);
3165 result += rhs;
3166 return result;
3167 }
3172 friend basic_string operator +(basic_string&& lhs, const xtd::char32 * rhs) {
3173 auto result = std::move(lhs);
3174 result += rhs;
3175 return result;
3176 }
3181 friend basic_string operator +(basic_string&& lhs, const xtd::char8 * rhs) {
3182 auto result = std::move(lhs);
3183 result += rhs;
3184 return result;
3185 }
3190 friend basic_string operator +(basic_string&& lhs, const xtd::wchar * rhs) {
3191 auto result = std::move(lhs);
3192 result += rhs;
3193 return result;
3194 }
3195
3200 friend basic_string operator +(const char* lhs, const basic_string & rhs) {
3201 auto result = basic_string(lhs);
3202 result += rhs;
3203 return result;
3204 }
3209 friend basic_string operator +(const xtd::char16 * lhs, const basic_string & rhs) {
3210 auto result = basic_string(lhs);
3211 result += rhs;
3212 return result;
3213 }
3218 friend basic_string operator +(const xtd::char32 * lhs, const basic_string & rhs) {
3219 auto result = basic_string(lhs);
3220 result += rhs;
3221 return result;
3222 }
3227 friend basic_string operator +(const xtd::char8 * lhs, const basic_string & rhs) {
3228 auto result = basic_string(lhs);
3229 result += rhs;
3230 return result;
3231 }
3236 friend basic_string operator +(const xtd::wchar * lhs, const basic_string & rhs) {
3237 auto result = basic_string(lhs);
3238 result += rhs;
3239 return result;
3240 }
3241
3246 friend basic_string operator +(const char* lhs, basic_string&& rhs) {
3247 auto result = basic_string(lhs);
3248 result += std::move(rhs);
3249 return result;
3250 }
3255 friend basic_string operator +(const xtd::char16 * lhs, basic_string&& rhs) {
3256 auto result = basic_string(lhs);
3257 result += std::move(rhs);
3258 return result;
3259 }
3264 friend basic_string operator +(const xtd::char32 * lhs, basic_string&& rhs) {
3265 auto result = basic_string(lhs);
3266 result += std::move(rhs);
3267 return result;
3268 }
3273 friend basic_string operator +(const xtd::char8 * lhs, basic_string&& rhs) {
3274 auto result = basic_string(lhs);
3275 result += std::move(rhs);
3276 return result;
3277 }
3282 friend basic_string operator +(const xtd::wchar * lhs, basic_string&& rhs) {
3283 auto result = basic_string(lhs);
3284 result += std::move(rhs);
3285 return result;
3286 }
3287
3292 friend basic_string operator +(const basic_string & lhs, const char rhs) {
3293 auto result = lhs;
3294 result += rhs;
3295 return result;
3296 }
3301 friend basic_string operator +(const basic_string & lhs, const xtd::char16 rhs) {
3302 auto result = lhs;
3303 result += rhs;
3304 return result;
3305 }
3310 friend basic_string operator +(const basic_string & lhs, const xtd::char32 rhs) {
3311 auto result = lhs;
3312 result += rhs;
3313 return result;
3314 }
3319 friend basic_string operator +(const basic_string & lhs, const xtd::char8 rhs) {
3320 auto result = lhs;
3321 result += rhs;
3322 return result;
3323 }
3328 friend basic_string operator +(const basic_string & lhs, const xtd::wchar rhs) {
3329 auto result = lhs;
3330 result += rhs;
3331 return result;
3332 }
3333
3338 friend basic_string operator +(basic_string&& lhs, const char rhs) {
3339 auto result = std::move(lhs);
3340 result += rhs;
3341 return result;
3342 }
3347 friend basic_string operator +(basic_string&& lhs, const xtd::char16 rhs) {
3348 auto result = std::move(lhs);
3349 result += rhs;
3350 return result;
3351 }
3356 friend basic_string operator +(basic_string&& lhs, const xtd::char32 rhs) {
3357 auto result = std::move(lhs);
3358 result += rhs;
3359 return result;
3360 }
3365 friend basic_string operator +(basic_string&& lhs, const xtd::char8 rhs) {
3366 auto result = std::move(lhs);
3367 result += rhs;
3368 return result;
3369 }
3374 friend basic_string operator +(basic_string&& lhs, const xtd::wchar rhs) {
3375 auto result = std::move(lhs);
3376 result += rhs;
3377 return result;
3378 }
3379
3384 friend basic_string operator +(char lhs, const basic_string & rhs) {
3385 auto result = basic_string(1, lhs);
3386 result += rhs;
3387 return result;
3388 }
3393 friend basic_string operator +(xtd::char16 lhs, const basic_string & rhs) {
3394 auto result = basic_string(1, lhs);
3395 result += rhs;
3396 return result;
3397 }
3402 friend basic_string operator +(xtd::char32 lhs, const basic_string & rhs) {
3403 auto result = basic_string(1, lhs);
3404 result += rhs;
3405 return result;
3406 }
3411 friend basic_string operator +(xtd::char8 lhs, const basic_string & rhs) {
3412 auto result = basic_string(1, lhs);
3413 result += rhs;
3414 return result;
3415 }
3420 friend basic_string operator +(xtd::wchar lhs, const basic_string & rhs) {
3421 auto result = basic_string(1, lhs);
3422 result += rhs;
3423 return result;
3424 }
3425
3430 friend basic_string operator +(char lhs, basic_string&& rhs) {
3431 auto result = basic_string(1, lhs);
3432 result += std::move(rhs);
3433 return result;
3434 }
3439 friend basic_string operator +(xtd::char16 lhs, basic_string&& rhs) {
3440 auto result = basic_string(1, lhs);
3441 result += std::move(rhs);
3442 return result;
3443 }
3448 friend basic_string operator +(xtd::char32 lhs, basic_string&& rhs) {
3449 auto result = basic_string(1, lhs);
3450 result += std::move(rhs);
3451 return result;
3452 }
3457 friend basic_string operator +(xtd::char8 lhs, basic_string&& rhs) {
3458 auto result = basic_string(1, lhs);
3459 result += std::move(rhs);
3460 return result;
3461 }
3466 friend basic_string operator +(xtd::wchar lhs, basic_string&& rhs) {
3467 auto result = basic_string(1, lhs);
3468 result += std::move(rhs);
3469 return result;
3470 }
3471
3480 //friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string& str) {return stream << str.to_string().chars_;}
3481 friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string & str) {
3482 if constexpr(std::is_same_v<char, char_t>) return stream << str.chars();
3483 else return stream << __xtd_convert_to_string<char>(str.chars());
3484 }
3491 friend std::basic_ostream<xtd::wchar>& operator <<(std::basic_ostream<xtd::wchar>& stream, const basic_string & str) {return stream << str.to_wstring().chars();}
3492
3501 friend std::basic_istream<char>& operator >>(std::basic_istream<char>& stream, basic_string & str) {
3502 auto s = std::basic_string<char> {};
3503 stream >> s;
3504 str = s;
3505 return stream;
3506 }
3515 friend std::basic_istream<xtd::wchar>& operator >>(std::basic_istream<xtd::wchar>& stream, basic_string & str) {
3516 auto s = std::basic_string<xtd::wchar> {};
3517 stream >> s;
3518 str = s;
3519 return stream;
3520 }
3522
3524
3528 [[deprecated("Replaced by xtd::basic_string::is_empty(const xtd::basic_string&) - Will be removed in version 0.4.0.")]]
3529 bool is_empty() const noexcept {return is_empty(self_);}
3535
3537
3538 template<class object_t>
3539 [[deprecated("Replaced by typeof_<object_t>().name() - Will be removed in version 0.4.0.")]]
3540 static basic_string class_name() {return get_class_name(full_class_name<object_t>());}
3545 template<class object_t>
3546 [[deprecated("Replaced by typeof_(object).name() - Will be removed in version 0.4.0.")]]
3547 static basic_string class_name(const object_t& object) {return get_class_name(full_class_name(object));}
3552 [[deprecated("Replaced by typeof_(info).name() - Will be removed in version 0.4.0.")]]
3553 static basic_string class_name(const std::type_info & info) {return __xtd_get_class_name(info);}
3558 template<class object_t>
3559 [[deprecated("Replaced by typeof_<object_t>().full_name() - Will be removed in version 0.4.0.")]]
3560 static basic_string full_class_name() {return demangle(typeid(object_t).name());}
3565 template<class object_t>
3566 [[deprecated("Replaced by typeof_(object).full_name() - Will be removed in version 0.4.0.")]]
3567 static basic_string full_class_name(const object_t& object) {return demangle(typeid(object).name());}
3572 [[deprecated("Replaced by typeof_(info).full_name() - Will be removed in version 0.4.0.")]]
3573 static basic_string full_class_name(const std::type_info & info) {return __xtd_get_full_class_name(info);}
3575
3576 private:
3577 friend class basic_string<char>;
3578 friend class basic_string<xtd::char16>;
3579 friend class basic_string<xtd::char32>;
3580 friend class basic_string<xtd::char8>;
3581 friend class basic_string<xtd::wchar>;
3582
3583 static const xtd::array<value_type> default_split_separators;
3584 static const xtd::array<value_type> default_trim_chars;
3585
3586 template<class arg_t>
3587 static auto convert_param(arg_t&& arg) noexcept {
3588 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();
3589 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();
3590 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();
3591 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();
3592 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();
3593 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();
3594 else return std::forward<arg_t>(arg);
3595 }
3596
3597 static basic_string get_class_name(const basic_string & full_name) {
3598 auto length = full_name.last_index_of("<");
3599 if (length == npos) length = full_name.length();
3600 if (full_name.last_index_of("::", 0, length) == npos) return full_name;
3601 return full_name.substring(full_name.last_index_of("::", 0, length) + 2);
3602 }
3603
3604 base_type chars_;
3605 };
3606}
3607
3608#define __XTD_BASIC_STRING_INTERNAL__
3609#include "basic_string_.hpp"
3610#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:1403
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:1527
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:1126
static basic_string class_name(const object_t &object)
Gets the class name of the specified object.
Definition basic_string.hpp:3547
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:1324
allocator_type get_allocator() const
Returns the allocator associated with the string.
Definition basic_string.hpp:1352
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:1415
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:1408
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:1178
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:1304
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:1109
enumerator_type get_enumerator() const noexcept override
Returns an enumerator that iterates through a collection.
Definition basic_string.hpp:1362
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:1348
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:1638
virtual const base_type & get_base_type() const noexcept
Returns the underlying base type.
Definition basic_string.hpp:1356
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:1249
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:1466
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:1286
static basic_string full_class_name(const std::type_info &info)
Gets the fully qualified class name of the specified object, including the namespace of the specified...
Definition basic_string.hpp:3573
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:1293
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:1222
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:1080
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:1184
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:1450
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:1205
int32 compare(size_type pos1, size_type count1, const_pointer s, size_type count2) const
Compares two character sequences.
Definition basic_string.hpp:1048
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:1473
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:1254
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:1071
basic_string quoted() const
Allows insertion and extraction of quoted strings, such as the ones found in CSV or XML.
Definition basic_string.hpp:1554
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:1154
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:1575
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:1342
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:1580
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:1481
static basic_string class_name()
Gets the class name of the object_t.
Definition basic_string.hpp:3540
static basic_string class_name(const std::type_info &info)
Gets the class name of the specified object.
Definition basic_string.hpp:3553
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:1330
bool is_empty() const noexcept
Indicates whether this basic_string is an empty basic_string (""). /.
Definition basic_string.hpp:3529
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:1166
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:1559
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:1059
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:1548
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:1597
xtd::size get_hash_code() const noexcept override
Returns the hash code for this basic_string.
Definition basic_string.hpp:1360
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:1076
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:1310
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:1228
bool ends_with(value_type value) const noexcept
Determines whether the end of this basic_string matches the specified character.
Definition basic_string.hpp:1104
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:1495
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:1192
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:1395
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:1134
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:1383
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:1260
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:1085
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:1210
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:1242
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:1236
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:1591
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:1121
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:1096
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:1541
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:1272
static basic_string full_class_name()
Definition basic_string.hpp:3560
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:1116
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:1198
static basic_string full_class_name(const object_t &object)
Gets the fully qualified class name of the specified object, including the namespace of the specified...
Definition basic_string.hpp:3567
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:1460
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:1534
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:1090
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:1298
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:1337
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:1172
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:1266
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:1280
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:1316
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:1140
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:1388
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:1216
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:1565
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:1487
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:1148
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:1161
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:1645
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
#define self_
The self_ expression is a reference value expression whose value is the reference of the implicit obj...
Definition self.hpp:20
constexpr xtd::size npos
Represents a value that is not a valid position in a collection.
Definition npos.hpp:26
constexpr xtd::size epos
Represents the index of the last valid element in a collection.
Definition epos.hpp:33
constexpr xtd::size bpos
Represents the index of the firsy valid element in a collection.
Definition bpos.hpp:25
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
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
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_reference operator[](size_type index) const
Gets the element at the specified zero-based index.
Definition read_only_span.hpp:400
constexpr size_type length() const noexcept
Returns the length of the current read_only_span.
Definition read_only_span.hpp:229
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
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.