xtd 0.2.0
basic_string.hpp
Go to the documentation of this file.
1
4#pragma once
6#define __XTD_CORE_INTERNAL__
11#undef __XTD_CORE_INTERNAL__
12#define __XTD_STD_INTERNAL__
14#undef __XTD_STD_INTERNAL__
17#include "hash_code.hpp"
18#include "icomparable.hpp"
19#include "iequatable.hpp"
20#include "null.hpp"
21#include "string_comparison.hpp"
23#include "types.hpp"
24#include "object.hpp"
25#include "parse.hpp"
26#include "to_string.hpp"
27#include "types.hpp"
28#include "unused.hpp"
29#include <cctype>
30#if defined(__xtd__cpp_lib_format)
31#include <format>
32#endif
33#include <iomanip>
34#include <ostream>
35#include <sstream>
36#include <string>
37
39template<class ...args_t>
40void __basic_string_extract_format_arg(xtd::basic_string<char>& fmt, xtd::array<__format_information<char>>& formats, args_t&&... args);
41template<class target_t, class source_t>
42std::basic_string<target_t> __xtd_convert_to_string(std::basic_string<source_t>&& str) noexcept;
43template<class target_t, class source_t>
44std::basic_string<target_t> __xtd_convert_to_string(const std::basic_string<source_t>& str) noexcept;
45std::basic_string<char> __xtd_demangle(const std::basic_string<char>& value) noexcept;
46std::basic_string<char> __xtd_get_class_name(const std::type_info& value) noexcept;
47std::basic_string<char> __xtd_get_full_class_name(const std::type_info& value) noexcept;
49
51namespace xtd {
70 template<class char_t, class traits_t, class allocator_t>
71 class basic_string : public object, public xtd::icomparable<basic_string<char_t, traits_t, allocator_t>>, public xtd::iequatable<basic_string<char_t, traits_t, allocator_t>>, public xtd::collections::generic::ienumerable<char_t> {
72 public:
74
78 using base_type = std::basic_string<char_t, traits_t, allocator_t>;
80 using traits_type = typename base_type::traits_type;
82 using value_type = typename base_type::value_type;
84 using allocator_type = typename base_type::allocator_type;
86 using size_type = typename base_type::size_type;
88 using difference_type = typename base_type::difference_type;
90 using reference = typename base_type::reference;
92 using const_reference = typename base_type::const_reference;
94 using pointer = typename base_type::pointer;
96 using const_pointer = typename base_type::const_pointer;
104 using reverse_iterator = typename base_type::reverse_iterator;
106 using const_reverse_iterator = typename base_type::const_reverse_iterator;
110
112
117
119 inline static constexpr size_type npos = base_type::npos;
121
123
126 basic_string() = default;
129 explicit basic_string(const allocator_type& allocator) noexcept;
130
133 basic_string(const basic_string<char>& str) noexcept {
134 if constexpr (std::is_same_v<char, char_t>) chars_ = str.chars_;
135 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
136 }
137
141 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = str.chars_;
142 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
143 }
147 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = str.chars_;
148 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
149 }
150#if defined(__xtd__cpp_lib_char8_t)
154 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = str.chars_;
155 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
156 }
157#endif
161 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = str.chars_;
162 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
163 }
164
168 basic_string(const basic_string<char>& str, const allocator_type& allocator) noexcept {
169 if constexpr (std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, allocator);
170 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
171 }
175 basic_string(const basic_string<xtd::char16>& str, const allocator_type& allocator) noexcept {
176 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, allocator);
177 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
178 }
182 basic_string(const basic_string<xtd::char32>& str, const allocator_type& allocator) noexcept {
183 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, allocator);
184 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
185 }
186#if defined(__xtd__cpp_lib_char8_t)
190 basic_string(const basic_string<xtd::char8>& str, const allocator_type& allocator) noexcept {
191 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, allocator);
192 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
193 }
194#endif
198 basic_string(const basic_string<xtd::wchar>& str, const allocator_type& allocator) noexcept {
199 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, allocator);
200 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
201 }
202
209 if constexpr (std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index);
210 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index)));
211 }
218 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index);
219 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index)));
220 }
227 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index);
228 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index)));
229 }
230#if defined(__xtd__cpp_lib_char8_t)
237 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index);
238 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index)));
239 }
240#endif
247 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index);
248 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index)));
249 }
250
256 basic_string(const basic_string<char>& str, xtd::size index, const allocator_type& allocator) {
258 if constexpr (std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index, allocator);
259 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index)), allocator);
260 }
266 basic_string(const basic_string<xtd::char16>& str, xtd::size index, const allocator_type& allocator) {
268 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index, allocator);
269 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index)), allocator);
270 }
276 basic_string(const basic_string<xtd::char32>& str, xtd::size index, const allocator_type& allocator) {
278 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index, allocator);
279 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index)), allocator);
280 }
281#if defined(__xtd__cpp_lib_char8_t)
287 basic_string(const basic_string<xtd::char8>& str, xtd::size index, const allocator_type& allocator) {
289 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index, allocator);
290 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index)), allocator);
291 }
292#endif
298 basic_string(const basic_string<xtd::wchar>& str, xtd::size index, const allocator_type& allocator) {
300 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index, allocator);
301 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index)), allocator);
302 }
303
311 if constexpr (std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index, count);
312 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index, count)));
313 }
321 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index, count);
322 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index, count)));
323 }
331 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index, count);
332 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index, count)));
333 }
334#if defined(__xtd__cpp_lib_char8_t)
342 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index, count);
343 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index, count)));
344 }
345#endif
353 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index, count);
354 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index, count)));
355 }
356
365 if constexpr (std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
366 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index, count)), allocator);
367 }
376 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
377 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index, count)), allocator);
378 }
387 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
388 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index, count)), allocator);
389 }
390#if defined(__xtd__cpp_lib_char8_t)
399 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
400 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index, count)), allocator);
401 }
402#endif
411 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
412 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index, count)), allocator);
413 }
414
418
422 basic_string(basic_string&& str, const allocator_type& allocator) noexcept : chars_(std::move(str.chars_)) {}
423
428 basic_string(xtd::size count, char character) : basic_string(std::basic_string<char>(count, character)) {}
433 basic_string(xtd::size count, char character, const allocator_type& allocator) : basic_string(std::basic_string<char>(count, character), allocator) {}
442 basic_string(xtd::size count, xtd::char16 character, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char16>(count, character), allocator) {}
451 basic_string(xtd::size count, xtd::char32 character, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char32>(count, character), allocator) {}
452#if defined(__xtd__cpp_lib_char8_t)
461 basic_string(xtd::size count, xtd::char8 character, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char8>(count, character), allocator) {}
462#endif
472 basic_string(xtd::size count, xtd::wchar character, const allocator_type& allocator) : basic_string(std::basic_string<xtd::wchar>(count, character), allocator) {}
473
477 basic_string(char character, xtd::size count) : basic_string(std::basic_string<char>(count, character)) {}
482 basic_string(char character, xtd::size count, const allocator_type& allocator) : basic_string(std::basic_string<char>(count, character), allocator) {}
491 basic_string(xtd::char16 character, xtd::size count, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char16>(count, character), allocator) {}
500 basic_string(xtd::char32 character, xtd::size count, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char32>(count, character), allocator) {}
501#if defined(__xtd__cpp_lib_char8_t)
510 basic_string(xtd::char8 character, xtd::size count, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char8>(count, character), allocator) {}
511#endif
520 basic_string(xtd::wchar character, xtd::size count, const allocator_type& allocator) : basic_string(std::basic_string<xtd::wchar>(count, character), allocator) {}
521
524 basic_string(const char* str) { // Can't be explicit by design.
526 if constexpr (std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str);
527 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str));
528 }
531 basic_string(const xtd::char16* str) { // Can't be explicit by design.
533 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str);
534 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str));
535 }
538 basic_string(const xtd::char32* str) { // Can't be explicit by design.
540 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str);
541 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str));
542 }
543#if defined(__xtd__cpp_lib_char8_t)
546 basic_string(const xtd::char8* str) { // Can't be explicit by design.
548 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str);
549 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str));
550 }
551#endif
554 basic_string(const xtd::wchar* str) { // Can't be explicit by design.
556 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
557 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
558 }
559
563 basic_string(const char* str, const allocator_type& allocator) {
565 if constexpr (std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str, allocator);
566 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str), allocator);
567 }
571 basic_string(const xtd::char16* str, const allocator_type& allocator) {
573 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str, allocator);
574 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str), allocator);
575 }
579 basic_string(const xtd::char32* str, const allocator_type& allocator) {
581 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str, allocator);
582 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str), allocator);
583 }
584#if defined(__xtd__cpp_lib_char8_t)
588 basic_string(const xtd::char8* str, const allocator_type& allocator) {
590 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str, allocator);
591 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str), allocator);
592 }
593#endif
597 basic_string(const xtd::wchar* str, const allocator_type& allocator) : chars_(allocator) {
599 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
600 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
601 }
602
605 basic_string(const char* str, xtd::size count) {
607 if constexpr (std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str, count);
608 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str, count));
609 }
614 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str, count);
615 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str, count));
616 }
621 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str, count);
622 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str, count));
623 }
624#if defined(__xtd__cpp_lib_char8_t)
629 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str, count);
630 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str, count));
631 }
632#endif
637 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str, count);
638 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str, count));
639 }
640
645 basic_string(const char* str, xtd::size count, const allocator_type& allocator) {
647 if constexpr (std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str, count, allocator);
648 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str, count), allocator);
649 }
654 basic_string(const xtd::char16* str, xtd::size count, const allocator_type& allocator) : chars_(allocator) {
656 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str, count, allocator);
657 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str, count), allocator);
658 }
663 basic_string(const xtd::char32* str, xtd::size count, const allocator_type& allocator) : chars_(allocator) {
665 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str, count, allocator);
666 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str, count), allocator);
667 }
668#if defined(__xtd__cpp_lib_char8_t)
673 basic_string(const xtd::char8* str, xtd::size count, const allocator_type& allocator) : chars_(allocator) {
675 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str, count, allocator);
676 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str, count), allocator);
677 }
678#endif
683 basic_string(const xtd::wchar* str, xtd::size count, const allocator_type& allocator) : chars_(allocator) {
685 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str, count, allocator);
686 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str, count), allocator);
687 }
688
691 basic_string(const std::basic_string<char>& str) noexcept { // Can't be explicit by design.
692 if constexpr (std::is_same_v<char, char_t>) chars_ = str;
693 else chars_ = __xtd_convert_to_string<value_type>(str);
694 }
697 basic_string(const std::basic_string<xtd::char16>& str) noexcept { // Can't be explicit by design.
698 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = str;
699 else chars_ = __xtd_convert_to_string<value_type>(str);
700 }
703 basic_string(const std::basic_string<xtd::char32>& str) noexcept { // Can't be explicit by design.
704 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = str;
705 else chars_ = __xtd_convert_to_string<value_type>(str);
706 }
707#if defined(__xtd__cpp_lib_char8_t)
710 basic_string(const std::basic_string<xtd::char8>& str) noexcept { // Can't be explicit by design.
711 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = str;
712 else chars_ = __xtd_convert_to_string<value_type>(str);
713 }
714#endif
717 basic_string(const std::basic_string<xtd::wchar>& str) noexcept { // Can't be explicit by design.
718 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = str;
719 else chars_ = __xtd_convert_to_string<value_type>(str);
720 }
721
725 basic_string(const std::basic_string<char>& str, const allocator_type& allocator) noexcept {
726 if constexpr (std::is_same_v<char, char_t>) chars_ = base_type(str, allocator);
727 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
728 }
732 basic_string(const std::basic_string<xtd::char16>& str, const allocator_type& allocator) noexcept {
733 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str, allocator);
734 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
735 }
739 basic_string(const std::basic_string<xtd::char32>& str, const allocator_type& allocator) noexcept {
740 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str, allocator);
741 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
742 }
743#if defined(__xtd__cpp_lib_char8_t)
747 basic_string(const std::basic_string<xtd::char8>& str, const allocator_type& allocator) noexcept {
748 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str, allocator);
749 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
750 }
751#endif
755 basic_string(const std::basic_string<xtd::wchar>& str, const allocator_type& allocator) noexcept {
756 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str, allocator);
757 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
758 }
759
763 template<class input_iterator_t>
764 basic_string(input_iterator_t first, input_iterator_t last) : chars_(first, last) {}
769 template<class input_iterator_t>
770 basic_string(input_iterator_t first, input_iterator_t last, const allocator_type& allocator) : chars_(first, last, allocator) {}
771
775 template<class string_view_like_t>
776 explicit constexpr basic_string(const string_view_like_t& string_view) : chars_(string_view) {}
780 template<class string_view_like_t>
781 explicit constexpr basic_string(const string_view_like_t& string_view, const allocator_type& allocator) : chars_(string_view, allocator) {}
787 template<class string_view_like_t>
788 constexpr basic_string(const string_view_like_t& string_view, size_type index, size_type count) : chars_(string_view, index, count) {}
794 template<class string_view_like_t>
795 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) {}
796
799 basic_string(std::initializer_list<char> il) : basic_string(std::basic_string<char>(il)) {}
802 basic_string(std::initializer_list<xtd::char16> il) : basic_string(std::basic_string<xtd::char16>(il)) {}
805 basic_string(std::initializer_list<xtd::char32> il) : basic_string(std::basic_string<xtd::char32>(il)) {}
806#if defined(__xtd__cpp_lib_char8_t)
809 basic_string(std::initializer_list<xtd::char8> il) : basic_string(std::basic_string<xtd::char8>(il)) {}
810#endif
813 basic_string(std::initializer_list<xtd::wchar> il) : basic_string(std::basic_string<xtd::wchar>(il)) {}
814
818 basic_string(std::initializer_list<char> il, const allocator_type& allocator) : basic_string(std::basic_string<char>(il), allocator) {}
822 basic_string(std::initializer_list<xtd::char16> il, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char16>(il), allocator) {}
826 basic_string(std::initializer_list<xtd::char32> il, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char32>(il), allocator) {}
827#if defined(__xtd__cpp_lib_char8_t)
831 basic_string(std::initializer_list<xtd::char8> il, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char8>(il), allocator) {}
832#endif
836 basic_string(std::initializer_list<xtd::wchar> il, const allocator_type& allocator) : basic_string(std::basic_string<xtd::wchar>(il), allocator) {}
838
840
845 const_reference back() const {return operator[](size() - 1);}
846
850
859 const_pointer c_str() const noexcept {return chars_.c_str();}
860
863 size_type capacity() const noexcept {return chars_.capacity();}
864
868
871 const_reverse_iterator crbegin() const {return chars_.crbegin();}
872
875 const base_type& chars() const noexcept {return chars_;}
876
880
883 const_reverse_iterator crend() const {return chars_.crend();}
884
892 const_pointer data() const noexcept {return chars_.data();}
893
896 bool empty() const noexcept {return chars_.empty();}
897
901
905 const_reference front() const {return operator[](0);}
906
910 size_type length() const noexcept {return chars_.size();}
911
914 size_type max_size() const noexcept {return chars_.max_size();}
915
918 const_reverse_iterator rbegin() const {return chars_.crbegin();}
919
922 const_reverse_iterator rend() const {return chars_.crend();}
923
926 size_type size() const noexcept {return chars_.size();}
928
930
935 const_reference at(size_type pos) const {return operator [](pos);}
936
955 int32 compare(const basic_string& str) const {return chars_.compare(str);}
977 int32 compare(size_type pos1, size_type count1, const basic_string& str) const {return chars_.compare(pos1, count1, str);}
1001 int32 compare(size_type pos1, size_type count1, const basic_string& str, size_type pos2) const {return chars_.compare(pos1, count1, str, pos2);}
1026 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);}
1045 int32 compare(const_pointer s) const {return chars_.compare(s);}
1067 int32 compare(size_type pos1, size_type count1, const_pointer s) const {return chars_.compare(pos1, count1, s);}
1090 int32 compare(size_type pos1, size_type count1, const_pointer s, size_type count2) const {return chars_.compare(pos1, count1, s, count2);}
1091
1101 int32 compare_to(const object& value) const {
1103 return compare_to(static_cast<const basic_string&>(value));
1104 }
1113 int32 compare_to(const basic_string& value) const noexcept override {return chars_.compare(value.chars_);}
1114
1118 virtual bool contains(value_type value) const noexcept {return find(value) != npos;}
1122 virtual bool contains(const basic_string& value) const noexcept {return find(value) != npos;}
1123
1127 bool equals(const object& obj) const noexcept override {return dynamic_cast<const basic_string*>(&obj) && equals(static_cast<const basic_string&>(obj));}
1132 bool equals(const basic_string& value) const noexcept override {return equals(value, false);}
1138 bool equals(const basic_string& value, bool ignore_case) const noexcept {
1139 if (ignore_case) return to_upper().chars_ == value.to_upper().chars_;
1140 return chars_ == value.chars_;
1141 }
1142
1146 bool ends_with(value_type value) const noexcept {return ends_with(value, false);}
1151 bool ends_with(value_type value, bool ignore_case) const noexcept {
1152 if (ignore_case) return to_lower().rfind(static_cast<value_type>(tolower(value))) == size() - 1;
1153 return rfind(value) == size() - 1;
1154 }
1158 bool ends_with(const basic_string& value) const noexcept {return ends_with(value, xtd::string_comparison::ordinal);}
1163 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);}
1168 bool ends_with(const basic_string& value, xtd::string_comparison comparison_type) const noexcept {
1169 if (comparison_type == xtd::string_comparison::ordinal_ignore_case) return to_lower().rfind(value.to_lower()) + value.to_lower().size() == size();
1170 return rfind(value) + value.size() == size();
1171 }
1172
1176 size_type find(const basic_string& str) const {return chars_.find(str);}
1182 size_type find(const basic_string& str, size_type pos) const {return chars_.find(str, pos);}
1190 size_type find(const_pointer s, size_type pos, size_type count) const {return chars_.find(s, pos, count);}
1196 size_type find(const_pointer s) const {return chars_.find(s);}
1203 size_type find(const_pointer s, size_type pos) const {return chars_.find(s, pos);}
1208 size_type find(value_type ch) const {return chars_.find(ch);}
1214 size_type find(value_type ch, size_type pos) const {return chars_.find(ch, pos);}
1215
1220 size_type find_first_of(const basic_string& str) const {return chars_.find_first_of(str);}
1226 size_type find_first_of(const basic_string& str, size_type pos) const {return chars_.find_first_of(str, pos);}
1234 size_type find_first_of(const_pointer s, size_type pos, size_type count) const {return chars_.find_first_of(s, pos, count);}
1240 size_type find_first_of(const_pointer s) const {return chars_.find_first_of(s);}
1247 size_type find_first_of(const_pointer s, size_type pos) const {return chars_.find_first_of(s, pos);}
1252 size_type find_first_of(char_t ch) const {return chars_.find_first_of(ch);}
1258 size_type find_first_of(char_t ch, size_type pos) const {return chars_.find_first_of(ch, pos);}
1259
1264 size_type find_first_not_of(const basic_string& str) const {return chars_.find_first_not_of(str);}
1270 size_type find_first_not_of(const basic_string& str, size_type pos) const {return chars_.find_first_not_of(str, pos);}
1278 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);}
1284 size_type find_first_not_of(const_pointer s) const {return chars_.find_first_not_of(s);}
1291 size_type find_first_not_of(const_pointer s, size_type pos) const {return chars_.find_first_not_of(s, pos);}
1296 size_type find_first_not_of(char_t ch) const {return chars_.find_first_not_of(ch);}
1302 size_type find_first_not_of(char_t ch, size_type pos) const {return chars_.find_first_not_of(ch, pos);}
1303
1308 size_type find_last_of(const basic_string& str) const {return chars_.find_last_of(str);}
1314 size_type find_last_of(const basic_string& str, size_type pos) const {return chars_.find_last_of(str, pos);}
1322 size_type find_last_of(const_pointer s, size_type pos, size_type count) const {return chars_.find_last_of(s, pos, count);}
1328 size_type find_last_of(const_pointer s) const {return chars_.find_last_of(s);}
1335 size_type find_last_of(const_pointer s, size_type pos) const {return chars_.find_last_of(s, pos);}
1340 size_type find_last_of(char_t ch) const {return chars_.find_last_of(ch);}
1346 size_type find_last_of(char_t ch, size_type pos) const {return chars_.find_last_of(ch, pos);}
1347
1352 size_type find_last_not_of(const basic_string& str) const {return chars_.find_last_not_of(str);}
1358 size_type find_last_not_of(const basic_string& str, size_type pos) const {return chars_.find_last_not_of(str, pos);}
1366 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);}
1372 size_type find_last_not_of(const_pointer s) const {return chars_.find_last_not_of(s);}
1379 size_type find_last_not_of(const_pointer s, size_type pos) const {return chars_.find_last_not_of(s, pos);}
1384 size_type find_last_not_of(char_t ch) const {return chars_.find_last_not_of(ch);}
1390 size_type find_last_not_of(char_t ch, size_type pos) const {return chars_.find_last_not_of(ch, pos);}
1391
1394 allocator_type get_allocator() const {return chars_.get_allocator();}
1395
1398 virtual const base_type& get_base_type() const noexcept {return chars_;}
1399
1402 xtd::size get_hash_code() const noexcept override {return xtd::hash_code::combine(chars_);}
1403
1404 enumerator_type get_enumerator() const noexcept override {
1405 class basic_string_enumerator : public xtd::collections::generic::ienumerator<value_type> {
1406 public:
1407 explicit basic_string_enumerator(const basic_string& chars) : chars_(chars) {}
1408
1409 const value_type& current() const override {return chars_[index_];}
1410
1411 bool move_next() override {return ++index_ < chars_.size();}
1412
1413 void reset() override {index_ = basic_string::npos;}
1414
1415 protected:
1416 const basic_string& chars_;
1417 xtd::size index_ = basic_string::npos;
1418 };
1419 return {new_ptr<basic_string_enumerator>(*this)};
1420 }
1421
1425 xtd::size index_of(const basic_string& value) const noexcept {return index_of(value, 0, size());}
1430 xtd::size index_of(const basic_string& value, xtd::size start_index) const {return index_of(value, start_index, size() - start_index);}
1437 xtd::size index_of(const basic_string& value, xtd::size start_index, xtd::size count) const {
1439 auto result = find(value, start_index);
1440 return result > start_index + count ? npos : result;
1441 }
1445 xtd::size index_of(value_type value) const noexcept {return index_of(value, 0, size());}
1450 xtd::size index_of(value_type value, xtd::size start_index) const {return index_of(value, start_index, size() - start_index);}
1459 auto result = find(value, start_index);
1460 return result > start_index + count ? npos : result;
1461 }
1462
1466 xtd::size index_of_any(const xtd::array<value_type>& values) const noexcept;
1472 xtd::size index_of_any(const xtd::array<value_type>& values, xtd::size start_index) const;
1481 xtd::size index_of_any(const std::initializer_list<value_type>& values) const noexcept;
1482 xtd::size index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index) const;
1483 xtd::size index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index, xtd::size count) const;
1485
1492 basic_string insert(xtd::size start_index, const basic_string& value) const {
1494 auto result = *this;
1495 result.chars_.insert(start_index, value);
1496 return result;
1497 }
1498
1502 [[deprecated("Replaced by xtd::basic_string::is_empty(const xtd::basic_string&) - Will be removed in version 0.4.0.")]]
1503 bool is_empty() const noexcept {return is_empty(*this);}
1504
1508 xtd::size last_index_of(const basic_string& value) const noexcept {return last_index_of(value, 0, size());}
1514 xtd::size last_index_of(const basic_string& value, xtd::size start_index) const {return last_index_of(value, start_index, size() - start_index);}
1521 xtd::size last_index_of(const basic_string& value, xtd::size start_index, xtd::size count) const {
1523 auto result = rfind(value, start_index + count - value.size());
1524 return result < start_index ? npos : result;
1525 }
1529 xtd::size last_index_of(value_type value) const noexcept {return last_index_of(value, 0, size());}
1535 xtd::size last_index_of(value_type value, xtd::size start_index) const {return last_index_of(value, start_index, size() - start_index);}
1545 auto result = rfind(value, start_index + count - 1);
1546 return result < start_index ? npos : result;
1547 }
1548
1565 xtd::size last_index_of_any(const std::initializer_list<value_type>& values) const noexcept;
1566 xtd::size last_index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index) const;
1567 xtd::size last_index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index, xtd::size count) const;
1569
1575 basic_string pad_left(xtd::size total_width) const noexcept {return pad_left(total_width, ' ');}
1582 basic_string pad_left(xtd::size total_width, char32 padding_char) const noexcept {return total_width < size() ? *this : basic_string(total_width - size(), padding_char) + *this;}
1583
1589 basic_string pad_right(xtd::size total_width) const noexcept {return pad_right(total_width, ' ');}
1596 basic_string pad_right(xtd::size total_width, char32 padding_char) const noexcept {return total_width < size() ? *this : *this + basic_string(total_width - size(), padding_char);}
1597
1602 basic_string quoted() const {return quoted('"', '\\');}
1607 basic_string quoted(value_type delimiter) const {return quoted(delimiter, '\\');}
1614 std::wstringstream ss;
1615 if constexpr (std::is_same_v<xtd::wchar, value_type>) ss << std::quoted(chars_, delimiter, escape);
1616 else ss << std::quoted(__xtd_convert_to_string<xtd::wchar>(chars_), static_cast<xtd::wchar>(delimiter), static_cast<xtd::wchar>(escape));
1617 return ss.str();
1618 }
1619
1623 basic_string remove(xtd::size start_index) const {return remove(start_index, size() - start_index);}
1630 auto result = *this;
1631 result.chars_.erase(start_index, count);
1632 return result;
1633 }
1634
1639 basic_string replace(value_type old_char, value_type new_char) const noexcept {return replace(string(1, old_char), string(1, new_char));}
1645 basic_string replace(const basic_string& old_string, const basic_string& new_string) const noexcept {
1646 auto result = *this;
1647 auto old_size = old_string.size();
1648 auto new_size = new_string.size();
1649 auto index = xtd::size {0};
1650 while (true) {
1651 index = result.find(old_string, index);
1652 if (index == npos) break;
1653 if (old_size == new_size) result.chars_.replace(index, old_size, new_string);
1654 else {
1655 result.chars_.erase(index, old_string.size());
1656 result.chars_.insert(index, new_string);
1657 }
1658 index += new_string.size();
1659 }
1660 return result;
1661 }
1662
1666 size_type rfind(const basic_string& str) const {return chars_.rfind(str);}
1672 size_type rfind(const basic_string& str, size_type pos) const {return chars_.rfind(str, pos);}
1680 size_type rfind(const_pointer s, size_type pos, size_type count) const {return chars_.rfind(s, pos, count);}
1686 size_type rfind(const_pointer s) const {return chars_.rfind(s);}
1693 size_type rfind(const_pointer s, size_type pos) const {return chars_.rfind(s, pos);}
1698 size_type rfind(value_type ch) const {return chars_.rfind(ch);}
1704 size_type rfind(value_type ch, size_type pos) const {return chars_.rfind(ch, pos);}
1705
1760 xtd::array<basic_string> split(const xtd::array<value_type>& separators) const noexcept;
1777 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::string_split_options options) const noexcept;
1786 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::size count) const noexcept;
1798 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::size count, xtd::string_split_options options) const noexcept;
1799
1804 bool starts_with(value_type value) const noexcept {return starts_with(value, false);}
1810 bool starts_with(value_type value, bool ignore_case) const noexcept {
1811 if (ignore_case) return to_lower().find(static_cast<value_type>(tolower(value))) == 0;
1812 return find(value) == 0;
1813 }
1818 bool starts_with(const basic_string& value) const noexcept {return starts_with(value, string_comparison::ordinal);}
1824 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);}
1829 bool starts_with(const basic_string& value, xtd::string_comparison comparison_type) const noexcept {
1830 if (comparison_type == xtd::string_comparison::ordinal_ignore_case) return to_lower().find(value.to_lower()) == 0;
1831 return find(value) == 0;
1832 }
1833
1838 basic_string substr() const {return chars_.substr();}
1846 return chars_.substr(pos);
1847 }
1856 return chars_.substr(pos, count);
1857 }
1858
1864 basic_string substring(xtd::size start_index) const {
1866 return substr(start_index);
1867 }
1875 return substr(start_index, length);
1876 }
1877
1884 xtd::array<value_type> to_array(xtd::size start_index) const;
1889 xtd::array<value_type> to_array(xtd::size start_index, xtd::size length) const;
1890
1893 xtd::array<value_type> to_char_array() const noexcept;
1899
1902 basic_string to_lower() const noexcept {
1903 auto result = basic_string::empty_string;
1904 std::for_each(chars_.begin(), chars_.end(), [&](auto c) {result += static_cast<value_type>(std::tolower(c));});
1905 return result;
1906 }
1907
1911 basic_string<char> to_string() const noexcept override {
1912 if constexpr (std::is_same_v<char, char_t>) return chars_;
1913 else return __xtd_convert_to_string<char>(chars_);
1914 }
1915
1918 basic_string to_title_case() const noexcept;
1919
1923 if constexpr (std::is_same_v<xtd::char16, char_t>) return chars_;
1924 else return __xtd_convert_to_string<xtd::char16>(chars_);
1925 }
1926
1930 if constexpr (std::is_same_v<xtd::char32, char_t>) return chars_;
1931 else return __xtd_convert_to_string<xtd::char32>(chars_);
1932 }
1933
1934#if defined(__xtd__cpp_lib_char8_t)
1938 if constexpr (std::is_same_v<xtd::char8, char_t>) return chars_;
1939 else return __xtd_convert_to_string<xtd::char8>(chars_);
1940 }
1941#endif
1942
1945 basic_string to_upper() const noexcept {
1946 auto result = basic_string::empty_string;
1947 std::for_each(chars_.begin(), chars_.end(), [&](auto c) {result += static_cast<value_type>(std::toupper(c));});
1948 return result;
1949 }
1950
1954 if constexpr (std::is_same_v<xtd::wchar, char_t>) return chars_;
1955 else return __xtd_convert_to_string<xtd::wchar>(chars_);
1956 }
1957
1962 basic_string trim() const noexcept {return trim(default_trim_chars);}
1967 basic_string trim(value_type trim_char) const noexcept;
1972 basic_string trim(const xtd::array<value_type>& trim_chars) const noexcept;
1973
1978 basic_string trim_end() const noexcept {return trim_end(default_trim_chars);}
1983 basic_string trim_end(value_type trim_char) const noexcept;
1988 basic_string trim_end(const xtd::array<value_type>& trim_chars) const noexcept;
1989
1994 basic_string trim_start() const noexcept {return trim_start(default_trim_chars);}
1999 basic_string trim_start(value_type trim_char) const noexcept;
2004 basic_string trim_start(const xtd::array<value_type>& trim_chars) const noexcept;
2006
2008
2014 template<class object_t>
2015 [[deprecated("Replaced by typeof_<object_t>().name() - Will be removed in version 0.4.0.")]]
2016 static basic_string class_name() {return get_class_name(full_class_name<object_t>());}
2021 template<class object_t>
2022 [[deprecated("Replaced by typeof_(object).name() - Will be removed in version 0.4.0.")]]
2023 static basic_string class_name(const object_t& object) {return get_class_name(full_class_name(object));}
2028 [[deprecated("Replaced by typeof_(info).name() - Will be removed in version 0.4.0.")]]
2029 static basic_string class_name(const std::type_info& info) {return __xtd_get_class_name(info);}
2030
2040 static int32 compare(const basic_string& str_a, const basic_string& str_b) noexcept {return compare(str_a, str_b, false);}
2051 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);}
2062 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);}
2075 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);}
2089 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);}
2103 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));}
2104
2111 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;}
2118 template<class object_a_t, class object_b_t, class object_c_t, class object_d_t>
2119 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);}
2125 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;}
2131 template<class object_a_t, class object_b_t, class object_c_t>
2132 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);}
2137 static basic_string concat(const basic_string& str_a, const basic_string& str_b) noexcept {return str_a + str_b;}
2142 template<class object_a_t, class object_b_t>
2143 static basic_string concat(object_a_t obj_a, object_b_t obj_b) noexcept {return format("{}{}", obj_a, obj_b);}
2147 static basic_string concat(const xtd::array<basic_string>& values) noexcept;
2149 static basic_string concat(const xtd::array<const_pointer>& values) noexcept;
2150 template<class other_char_t>
2151 static basic_string concat(const xtd::array<const other_char_t*>& values) noexcept;
2152 static basic_string concat(const std::initializer_list<basic_string>& values) noexcept {
2153 auto result = basic_string::empty_string;
2154 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2155 return result;
2156 }
2157 static basic_string concat(const std::initializer_list<const_pointer>& values) noexcept {
2158 auto result = basic_string::empty_string;
2159 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2160 return result;
2161 }
2162 template<class other_char_t>
2163 static basic_string concat(const std::initializer_list<const other_char_t*>& values) noexcept {
2164 auto result = basic_string::empty_string;
2165 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2166 return result;
2167 }
2172 template<class object_t>
2173 static basic_string concat(const xtd::array<object_t>& args) noexcept;
2175 template<class object_t>
2176 static basic_string concat(const std::initializer_list<object_t>& args) noexcept {
2177 basic_string result;
2178 for (const auto& arg : args)
2179 result += format("{}", arg);
2180 return result;
2181 }
2186 template<class value_t>
2187 static basic_string concat(value_t value) noexcept {
2188 return format("{}", value);
2189 }
2190
2211 static basic_string demangle(const basic_string& name) {
2212 if constexpr (std::is_same_v<char, char_t>) return __xtd_demangle(name.chars());
2213 else return __xtd_demangle(__xtd_convert_to_string<char>(name.chars()));
2214 }
2215
2221 static bool equals(const basic_string& a, const basic_string& b) noexcept{return a.equals(b);}
2227 template<class char_a_t, class char_b_t>
2228 static bool equals(const char_a_t* a, const char_b_t* b) noexcept{return basic_string {a}.equals(basic_string {b});}
2229
2236 static bool equals(const basic_string& a, const basic_string& b, bool ignore_case) noexcept {return a.equals(b, ignore_case);}
2243 template<class char_a_t, class char_b_t>
2244 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);}
2245
2252 template<class ...args_t>
2253 static basic_string format(const basic_string<char>& fmt, args_t&& ... args);
2254
2259 template<class object_t>
2260 [[deprecated("Replaced by typeof_<object_t>().full_name() - Will be removed in version 0.4.0.")]]
2261 static basic_string full_class_name() {return demangle(typeid(object_t).name());}
2266 template<class object_t>
2267 [[deprecated("Replaced by typeof_(object).full_name() - Will be removed in version 0.4.0.")]]
2268 static basic_string full_class_name(const object_t& object) {return demangle(typeid(object).name());}
2273 [[deprecated("Replaced by typeof_(info).full_name() - Will be removed in version 0.4.0.")]]
2274 static basic_string full_class_name(const std::type_info& info) {return __xtd_get_full_class_name(info);}
2275
2279 static bool is_empty(const xtd::basic_string<value_type, traits_type, allocator_type>& string) noexcept {return !string.length();}
2280
2287 template<class collection_t>
2288 static basic_string join(const basic_string separator, const collection_t& values) noexcept {
2289 xtd::size i = 0;
2290 basic_string result;
2291 for (const auto& item : values)
2292 result += format("{}{}", (i++ != 0 ? separator : basic_string {}), item);
2293 return result;
2294 }
2302 template<class collection_t>
2303 static basic_string join(const basic_string& separator, const collection_t& values, xtd::size index) {return join(separator, values, index, values.size() - index);}
2312 template<class collection_t>
2313 static basic_string join(const basic_string& separator, const collection_t& values, xtd::size index, xtd::size count) {
2314 if (index > values.size() || index + count > values.size()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range);
2315 xtd::size i = 0;
2316 basic_string result;
2317 for (const auto& item : values) {
2318 if (i >= index) result += format("{}{}", (i != index ? separator : basic_string {}), item);
2319 if (++i >= index + count) break;
2320 }
2321 return result;
2322 }
2323
2325 template<class value_t>
2326 static basic_string join(const basic_string& separator, const std::initializer_list<value_t>& values) noexcept;
2327 template<class value_t>
2328 static basic_string join(const basic_string& separator, const std::initializer_list<value_t>& values, xtd::size index);
2329 template<class value_t>
2330 static basic_string join(const basic_string& separator, const std::initializer_list<value_t>& values, xtd::size index, xtd::size count);
2332
2336 template<class value_t>
2337 static value_t parse(const basic_string& str) {
2338 if constexpr (std::is_same_v<char, char_t>) return xtd::parse<value_t>(str.chars());
2339 else return xtd::parse<value_t>(__xtd_convert_to_string<char>(str.chars()));
2340 }
2341
2401 template<class ...args_t>
2402 static basic_string sprintf(const basic_string& fmt, args_t&& ... args) noexcept {return __sprintf(fmt.c_str(), convert_param(std::forward<args_t>(args)) ...);}
2403
2408 template<class value_t>
2409 static bool try_parse(const basic_string& str, value_t& value) noexcept {
2410 try {
2411 value = parse<value_t>(str);
2412 return true;
2413 } catch (...) {
2414 return false;
2415 }
2416 }
2418
2420
2428 return chars_[index];
2429 }
2430
2433 operator const base_type&() const noexcept {return chars_;}
2434
2439 if constexpr(std::is_same<char_t, char>::value) chars_ = str.chars_;
2440 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2441 return *this;
2442 }
2447 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str.chars_;
2448 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2449 return *this;
2450 }
2455 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str.chars_;
2456 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2457 return *this;
2458 }
2459#if defined(__xtd__cpp_lib_char8_t)
2464 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str.chars_;
2465 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2466 return *this;
2467 }
2468#endif
2473 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str.chars_;
2474 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2475 return *this;
2476 }
2477
2482 if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str.chars_);
2483 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2484 return *this;
2485 }
2490 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str.chars_);
2491 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2492 return *this;
2493 }
2498 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str.chars_);
2499 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2500 return *this;
2501 }
2502#if defined(__xtd__cpp_lib_char8_t)
2507 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str.chars_);
2508 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2509 return *this;
2510 }
2511#endif
2516 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str.chars_);
2517 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2518 return *this;
2519 }
2520
2524 basic_string& operator =(const std::basic_string<char>& str) noexcept {
2525 if constexpr(std::is_same<char_t, char>::value) chars_ = str;
2526 else chars_ = __xtd_convert_to_string<value_type>(str);
2527 return *this;
2528 }
2532 basic_string& operator =(const std::basic_string<xtd::char16>& str) noexcept {
2533 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str;
2534 else chars_ = __xtd_convert_to_string<value_type>(str);
2535 return *this;
2536 }
2540 basic_string& operator =(const std::basic_string<xtd::char32>& str) noexcept {
2541 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str;
2542 else chars_ = __xtd_convert_to_string<value_type>(str);
2543 return *this;
2544 }
2545#if defined(__xtd__cpp_lib_char8_t)
2549 basic_string& operator =(const std::basic_string<xtd::char8>& str) noexcept {
2550 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str;
2551 else chars_ = __xtd_convert_to_string<value_type>(str);
2552 return *this;
2553 }
2554#endif
2558 basic_string& operator =(const std::basic_string<xtd::wchar>& str) noexcept {
2559 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str;
2560 else chars_ = __xtd_convert_to_string<value_type>(str);
2561 return *this;
2562 }
2563
2567 basic_string& operator =(std::basic_string<char>&& str) noexcept {
2568 if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str);
2569 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2570 return *this;
2571 }
2575 basic_string& operator =(std::basic_string<xtd::char16>&& str) noexcept {
2576 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str);
2577 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2578 return *this;
2579 }
2583 basic_string& operator =(std::basic_string<xtd::char32>&& str) noexcept {
2584 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str);
2585 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2586 return *this;
2587 }
2588#if defined(__xtd__cpp_lib_char8_t)
2592 basic_string& operator =(std::basic_string<xtd::char8>&& str) noexcept {
2593 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str);
2594 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2595 return *this;
2596 }
2597#endif
2601 basic_string& operator =(std::basic_string<xtd::wchar>&& str) noexcept {
2602 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str);
2603 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2604 return *this;
2605 }
2606
2611 basic_string& operator =(const char* str) {
2613 if constexpr (std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str);
2614 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str));
2615 return *this;
2616 }
2623 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str);
2624 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str));
2625 return *this;
2626 }
2633 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str);
2634 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str));
2635 return *this;
2636 }
2637#if defined(__xtd__cpp_lib_char8_t)
2644 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str);
2645 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str));
2646 return *this;
2647 }
2648#endif
2655 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
2656 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
2657 return *this;
2658 }
2659
2663 basic_string& operator =(char character) {
2664 *this = basic_string(1, character);
2665 return *this;
2666 }
2671 *this = basic_string(1, character);
2672 return *this;
2673 }
2678 *this = basic_string(1, character);
2679 return *this;
2680 }
2681#if defined(__xtd__cpp_lib_char8_t)
2686 *this = basic_string(1, character);
2687 return *this;
2688 }
2689#endif
2694 *this = basic_string(1, character);
2695 return *this;
2696 }
2697
2701 basic_string& operator =(const std::initializer_list<char>& il) {
2702 *this = basic_string(il);
2703 return *this;
2704 }
2708 basic_string& operator =(const std::initializer_list<xtd::char16>& il) {
2709 *this = basic_string(il);
2710 return *this;
2711 }
2715 basic_string& operator =(const std::initializer_list<xtd::char32>& il) {
2716 *this = basic_string(il);
2717 return *this;
2718 }
2719#if defined(__xtd__cpp_lib_char8_t)
2723 basic_string& operator =(const std::initializer_list<xtd::char8>& il) {
2724 *this = basic_string(il);
2725 return *this;
2726 }
2727#endif
2731 basic_string& operator =(const std::initializer_list<xtd::wchar>& il) {
2732 *this = basic_string(il);
2733 return *this;
2734 }
2735
2740 if constexpr (std::is_same_v<char, char_t>) chars_ += str.chars_;
2741 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2742 return *this;
2743 }
2748 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ += str.chars_;
2749 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2750 return *this;
2751 }
2756 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ += str.chars_;
2757 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2758 return *this;
2759 }
2760#if defined(__xtd__cpp_lib_char8_t)
2765 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ += str.chars_;
2766 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2767 return *this;
2768 }
2769#endif
2774 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ += str.chars_;
2775 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2776 return *this;
2777 }
2778
2783 if constexpr (std::is_same_v<char, char_t>) chars_ += std::move(str.chars_);
2784 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2785 return *this;
2786 }
2791 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ += std::move(str.chars_);
2792 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2793 return *this;
2794 }
2799 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ += std::move(str.chars_);
2800 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2801 return *this;
2802 }
2803#if defined(__xtd__cpp_lib_char8_t)
2808 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ += std::move(str.chars_);
2809 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2810 return *this;
2811 }
2812#endif
2817 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ += std::move(str.chars_);
2818 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2819 return *this;
2820 }
2821
2825 basic_string& operator +=(const std::basic_string<char>& str) {
2826 if constexpr (std::is_same_v<char, char_t>) chars_ += str;
2827 else chars_ += __xtd_convert_to_string<value_type>(str);
2828 return *this;
2829 }
2833 basic_string& operator +=(const std::basic_string<xtd::char16>& str) {
2834 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ += str;
2835 else chars_ += __xtd_convert_to_string<value_type>(str);
2836 return *this;
2837 }
2841 basic_string& operator +=(const std::basic_string<xtd::char32>& str) {
2842 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ += str;
2843 else chars_ += __xtd_convert_to_string<value_type>(str);
2844 return *this;
2845 }
2846#if defined(__xtd__cpp_lib_char8_t)
2850 basic_string& operator +=(const std::basic_string<xtd::char8>& str) {
2851 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ += str;
2852 else chars_ += __xtd_convert_to_string<value_type>(str);
2853 return *this;
2854 }
2855#endif
2859 basic_string& operator +=(const std::basic_string<xtd::wchar>& str) {
2860 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ += str;
2861 else chars_ += __xtd_convert_to_string<value_type>(str);
2862 return *this;
2863 }
2864
2868 basic_string& operator +=(const char* str) {
2869 chars_ += basic_string(str).chars_;
2870 return *this;
2871 }
2876 chars_.append(basic_string(str).chars_); return *this;
2877 }
2882 chars_ += basic_string(str).chars_;
2883 return *this;
2884 }
2885#if defined(__xtd__cpp_lib_char8_t)
2890 chars_ += basic_string(str).chars_;
2891 return *this;
2892 }
2893#endif
2898 chars_ += basic_string(str).chars_;
2899 return *this;
2900 }
2905 chars_ += basic_string(1, ch).chars_;
2906 return *this;
2907 }
2912 chars_ += basic_string(1, ch).chars_;
2913 return *this;
2914 }
2919 chars_ += basic_string(1, ch).chars_;
2920 return *this;
2921 }
2922#if defined(__xtd__cpp_lib_char8_t)
2927 chars_ += basic_string(1, ch).chars_;
2928 return *this;
2929 }
2930#endif
2935 chars_ += basic_string(1, ch).chars_;
2936 return *this;
2937 }
2938
2944 auto result = lhs;
2945 result += rhs;
2946 return result;
2947 }
2953 auto result = lhs;
2954 result += rhs;
2955 return result;
2956 }
2962 auto result = lhs;
2963 result += rhs;
2964 return result;
2965 }
2966#if defined(__xtd__cpp_lib_char8_t)
2972 auto result = lhs;
2973 result += rhs;
2974 return result;
2975 }
2976#endif
2982 auto result = lhs;
2983 result += rhs;
2984 return result;
2985 }
2986
2992 auto result = std::move(lhs);
2993 result += std::move(rhs);
2994 return result;
2995 }
3001 auto result = std::move(lhs);
3002 result += std::move(rhs);
3003 return result;
3004 }
3010 auto result = std::move(lhs);
3011 result += std::move(rhs);
3012 return result;
3013 }
3014#if defined(__xtd__cpp_lib_char8_t)
3020 auto result = std::move(lhs);
3021 result += std::move(rhs);
3022 return result;
3023 }
3024#endif
3030 auto result = std::move(lhs);
3031 result += std::move(rhs);
3032 return result;
3033 }
3034
3040 auto result = std::move(lhs);
3041 result += rhs;
3042 return result;
3043 }
3049 auto result = std::move(lhs);
3050 result += rhs;
3051 return result;
3052 }
3058 auto result = std::move(lhs);
3059 result += rhs;
3060 return result;
3061 }
3062#if defined(__xtd__cpp_lib_char8_t)
3068 auto result = std::move(lhs);
3069 result += rhs;
3070 return result;
3071 }
3072#endif
3078 auto result = std::move(lhs);
3079 result += rhs;
3080 return result;
3081 }
3082
3088 auto result = lhs;
3089 result += std::move(rhs);
3090 return result;
3091 }
3097 auto result = lhs;
3098 result += std::move(rhs);
3099 return result;
3100 }
3106 auto result = lhs;
3107 result += std::move(rhs);
3108 return result;
3109 }
3110#if defined(__xtd__cpp_lib_char8_t)
3116 auto result = lhs;
3117 result += std::move(rhs);
3118 return result;
3119 }
3120#endif
3126 auto result = lhs;
3127 result += std::move(rhs);
3128 return result;
3129 }
3130
3135 friend basic_string operator +(const basic_string& lhs, const std::basic_string<char>& rhs) {
3136 auto result = lhs;
3137 result += rhs;
3138 return result;
3139 }
3144 friend basic_string operator +(const basic_string& lhs, const std::basic_string<xtd::char16>& rhs) {
3145 auto result = lhs;
3146 result += rhs;
3147 return result;
3148 }
3153 friend basic_string operator +(const basic_string& lhs, const std::basic_string<xtd::char32>& rhs) {
3154 auto result = lhs;
3155 result += rhs;
3156 return result;
3157 }
3158#if defined(__xtd__cpp_lib_char8_t)
3163 friend basic_string operator +(const basic_string& lhs, const std::basic_string<xtd::char8>& rhs) {
3164 auto result = lhs;
3165 result += rhs;
3166 return result;
3167 }
3168#endif
3173 friend basic_string operator +(const basic_string& lhs, const std::basic_string<xtd::wchar>& rhs) {
3174 auto result = lhs;
3175 result += rhs;
3176 return result;
3177 }
3178
3183 friend basic_string operator +(const std::basic_string<char>& lhs, const basic_string& rhs) {
3184 auto result = lhs;
3185 if constexpr (std::is_same_v<char, char_t>) result += rhs.chars();
3186 else result += __xtd_convert_to_string<char>(rhs.chars());
3187 return result;
3188 }
3193 friend basic_string operator +(const std::basic_string<xtd::char16>& lhs, const basic_string& rhs) {
3194 auto result = lhs;
3195 if constexpr (std::is_same_v<xtd::char16, char_t>) result += rhs.chars();
3196 else result += __xtd_convert_to_string<xtd::char16>(rhs.chars());
3197 return result;
3198 }
3203 friend basic_string operator +(const std::basic_string<xtd::char32>& lhs, const basic_string& rhs) {
3204 auto result = lhs;
3205 if constexpr (std::is_same_v<xtd::char32, char_t>) result += rhs.chars();
3206 else result += __xtd_convert_to_string<xtd::char32>(rhs.chars());
3207 return result;
3208 }
3209#if defined(__xtd__cpp_lib_char8_t)
3214 friend basic_string operator +(const std::basic_string<xtd::char8>& lhs, const basic_string& rhs) {
3215 auto result = lhs;
3216 if constexpr (std::is_same_v<xtd::char8, char_t>) result += rhs.chars();
3217 else result += __xtd_convert_to_string<xtd::char8>(rhs.chars());
3218 return result;
3219 }
3220#endif
3225 friend basic_string operator +(const std::basic_string<xtd::wchar>& lhs, const basic_string& rhs) {
3226 auto result = lhs;
3227 if constexpr (std::is_same_v<xtd::wchar, char_t>) result += rhs.chars();
3228 else result += __xtd_convert_to_string<xtd::wchar>(rhs.chars());
3229 return result;
3230 }
3231
3236 friend basic_string operator +(const basic_string& lhs, const char* rhs) {
3237 auto result = lhs;
3238 result += rhs;
3239 return result;
3240 }
3245 friend basic_string operator +(const basic_string& lhs, const xtd::char16* rhs) {
3246 auto result = lhs;
3247 result += rhs;
3248 return result;
3249 }
3254 friend basic_string operator +(const basic_string& lhs, const xtd::char32* rhs) {
3255 auto result = lhs;
3256 result += rhs;
3257 return result;
3258 }
3259#if defined(__xtd__cpp_lib_char8_t)
3264 friend basic_string operator +(const basic_string& lhs, const xtd::char8* rhs) {
3265 auto result = lhs;
3266 result += rhs;
3267 return result;
3268 }
3269#endif
3274 friend basic_string operator +(const basic_string& lhs, const xtd::wchar* rhs) {
3275 auto result = lhs;
3276 result += rhs;
3277 return result;
3278 }
3279
3284 friend basic_string operator +(basic_string&& lhs, const char* rhs) {
3285 auto result = std::move(lhs);
3286 result += rhs;
3287 return result;
3288 }
3294 auto result = std::move(lhs);
3295 result += rhs;
3296 return result;
3297 }
3303 auto result = std::move(lhs);
3304 result += rhs;
3305 return result;
3306 }
3307#if defined(__xtd__cpp_lib_char8_t)
3313 auto result = std::move(lhs);
3314 result += rhs;
3315 return result;
3316 }
3317#endif
3323 auto result = std::move(lhs);
3324 result += rhs;
3325 return result;
3326 }
3327
3332 friend basic_string operator +(const char* lhs, const basic_string& rhs) {
3333 auto result = basic_string(lhs);
3334 result += rhs;
3335 return result;
3336 }
3341 friend basic_string operator +(const xtd::char16* lhs, const basic_string& rhs) {
3342 auto result = basic_string(lhs);
3343 result += rhs;
3344 return result;
3345 }
3350 friend basic_string operator +(const xtd::char32* lhs, const basic_string& rhs) {
3351 auto result = basic_string(lhs);
3352 result += rhs;
3353 return result;
3354 }
3355#if defined(__xtd__cpp_lib_char8_t)
3360 friend basic_string operator +(const xtd::char8* lhs, const basic_string& rhs) {
3361 auto result = basic_string(lhs);
3362 result += rhs;
3363 return result;
3364 }
3365#endif
3370 friend basic_string operator +(const xtd::wchar* lhs, const basic_string& rhs) {
3371 auto result = basic_string(lhs);
3372 result += rhs;
3373 return result;
3374 }
3375
3380 friend basic_string operator +(const char* lhs, basic_string&& rhs) {
3381 auto result = basic_string(lhs);
3382 result += std::move(rhs);
3383 return result;
3384 }
3390 auto result = basic_string(lhs);
3391 result += std::move(rhs);
3392 return result;
3393 }
3399 auto result = basic_string(lhs);
3400 result += std::move(rhs);
3401 return result;
3402 }
3403
3404#if defined(__xtd__cpp_lib_char8_t)
3410 auto result = basic_string(lhs);
3411 result += std::move(rhs);
3412 return result;
3413 }
3414#endif
3420 auto result = basic_string(lhs);
3421 result += std::move(rhs);
3422 return result;
3423 }
3424
3429 friend basic_string operator +(const basic_string& lhs, const char rhs) {
3430 auto result = lhs;
3431 result += rhs;
3432 return result;
3433 }
3438 friend basic_string operator +(const basic_string& lhs, const xtd::char16 rhs) {
3439 auto result = lhs;
3440 result += rhs;
3441 return result;
3442 }
3447 friend basic_string operator +(const basic_string& lhs, const xtd::char32 rhs) {
3448 auto result = lhs;
3449 result += rhs;
3450 return result;
3451 }
3452#if defined(__xtd__cpp_lib_char8_t)
3457 friend basic_string operator +(const basic_string& lhs, const xtd::char8 rhs) {
3458 auto result = lhs;
3459 result += rhs;
3460 return result;
3461 }
3462#endif
3467 friend basic_string operator +(const basic_string& lhs, const xtd::wchar rhs) {
3468 auto result = lhs;
3469 result += rhs;
3470 return result;
3471 }
3472
3477 friend basic_string operator +(basic_string&& lhs, const char rhs) {
3478 auto result = std::move(lhs);
3479 result += rhs;
3480 return result;
3481 }
3487 auto result = std::move(lhs);
3488 result += rhs;
3489 return result;
3490 }
3496 auto result = std::move(lhs);
3497 result += rhs;
3498 return result;
3499 }
3500#if defined(__xtd__cpp_lib_char8_t)
3506 auto result = std::move(lhs);
3507 result += rhs;
3508 return result;
3509 }
3510#endif
3516 auto result = std::move(lhs);
3517 result += rhs;
3518 return result;
3519 }
3520
3525 friend basic_string operator +(char lhs, const basic_string& rhs) {
3526 auto result = basic_string(1, lhs);
3527 result += rhs;
3528 return result;
3529 }
3535 auto result = basic_string(1, lhs);
3536 result += rhs;
3537 return result;
3538 }
3544 auto result = basic_string(1, lhs);
3545 result += rhs;
3546 return result;
3547 }
3548#if defined(__xtd__cpp_lib_char8_t)
3554 auto result = basic_string(1, lhs);
3555 result += rhs;
3556 return result;
3557 }
3558#endif
3564 auto result = basic_string(1, lhs);
3565 result += rhs;
3566 return result;
3567 }
3568
3573 friend basic_string operator +(char lhs, basic_string&& rhs) {
3574 auto result = basic_string(1, lhs);
3575 result += std::move(rhs);
3576 return result;
3577 }
3583 auto result = basic_string(1, lhs);
3584 result += std::move(rhs);
3585 return result;
3586 }
3592 auto result = basic_string(1, lhs);
3593 result += std::move(rhs);
3594 return result;
3595 }
3596#if defined(__xtd__cpp_lib_char8_t)
3602 auto result = basic_string(1, lhs);
3603 result += std::move(rhs);
3604 return result;
3605 }
3606#endif
3612 auto result = basic_string(1, lhs);
3613 result += std::move(rhs);
3614 return result;
3615 }
3616
3625 //friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string& str) {return stream << str.to_string().chars_;}
3626 friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string& str) {
3627 if constexpr (std::is_same_v<char, char_t>) return stream << str.chars();
3628 else return stream << __xtd_convert_to_string<char>(str.chars());
3629 }
3636 friend std::basic_ostream<xtd::wchar>& operator <<(std::basic_ostream<xtd::wchar>& stream, const basic_string& str) {return stream << str.to_wstring().chars();}
3637
3646 friend std::basic_istream<char>& operator >>(std::basic_istream<char>& stream, basic_string& str) {
3647 auto s = std::basic_string<char> {};
3648 stream >> s;
3649 str = s;
3650 return stream;
3651 }
3660 friend std::basic_istream<xtd::wchar>& operator >>(std::basic_istream<xtd::wchar>& stream, basic_string& str) {
3661 auto s = std::basic_string<xtd::wchar> {};
3662 stream >> s;
3663 str = s;
3664 return stream;
3665 }
3667
3668 private:
3669 friend class basic_string<char>;
3670 friend class basic_string<xtd::char16>;
3671 friend class basic_string<xtd::char32>;
3672#if defined(__xtd__cpp_lib_char8_t)
3673 friend class basic_string<xtd::char8>;
3674#endif
3675 friend class basic_string<xtd::wchar>;
3676
3677 static const xtd::array<value_type> default_split_separators;
3678 static const xtd::array<value_type> default_trim_chars;
3679
3680 template<class arg_t>
3681 static auto convert_param(arg_t&& arg) noexcept {
3682 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();
3683 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();
3684 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();
3685#if defined(__xtd__cpp_lib_char8_t)
3686 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();
3687#endif
3688 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();
3689 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();
3690 else return std::forward<arg_t>(arg);
3691 }
3692
3693 static basic_string get_class_name(const basic_string& full_name) {
3694 auto length = full_name.last_index_of("<");
3695 if (length == npos) length = full_name.length();
3696 if (full_name.last_index_of("::", 0, length) == npos) return full_name;
3697 return full_name.substring(full_name.last_index_of("::", 0, length) + 2);
3698 }
3699
3700 typename base_type::iterator to_base_type_iterator(iterator value) const noexcept {
3701 if (value == begin()) return chars_.begin();
3702 if (value == end()) return chars_.end();
3703 return chars_.begin() + (value - begin());
3704 }
3705
3706 iterator to_iterator(typename base_type::iterator value) const noexcept {
3707 if (value == chars_.begin()) return begin();
3708 if (value == chars_.end()) return end();
3709 return begin() + (value - chars_.begin());
3710 }
3711
3712 base_type chars_;
3713 };
3714}
3715
3716#define __XTD_BASIC_STRING_INTERNAL__
3717#include "basic_string_.hpp"
3718#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:59
Represents text as a sequence of character units.
Definition basic_string.hpp:71
basic_string(const basic_string< xtd::char32 > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:146
basic_string trim(value_type trim_char) const noexcept
Removes all leading and trailing occurrences of a character specified from the specified xtd::basic_s...
basic_string(const xtd::char8 *str, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring and count characters.
Definition basic_string.hpp:627
basic_string(const basic_string< xtd::char32 > &str, xtd::size index, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring at index and count character...
Definition basic_string.hpp:329
std::basic_string< char_t, traits_t, allocator_t > base_type
Represents the basic string base type.
Definition basic_string.hpp:78
static basic_string concat(object_a_t obj_a, object_b_t obj_b) noexcept
Concatenates two specified instances of object.
Definition basic_string.hpp:2143
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:1445
static int32 compare(const basic_string &str_a, const basic_string &str_b, xtd::string_comparison comparison_type) noexcept
Compares two specified basic_string objects using the specified rules, and returns an integer that in...
Definition basic_string.hpp:2062
basic_string trim_end(const xtd::array< value_type > &trim_chars) const noexcept
Removes all trailing occurrences of a set of characters specified in an array from the specified xtd:...
basic_string to_lower() const noexcept
Returns a copy of the current xtd::basic_string converted to lowercase.
Definition basic_string.hpp:1902
static value_t parse(const basic_string &str)
Converts a basic_string into a value_t type.
Definition basic_string.hpp:2337
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:1575
basic_string(const basic_string< char > &str, xtd::size index)
Initializes a new instance of xtd::basic_string with specified substring at index.
Definition basic_string.hpp:207
static const basic_string empty_string
Represents the empty basic_string.
Definition basic_string.hpp:116
basic_string(xtd::size count, xtd::char16 character, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:442
basic_string(const basic_string< xtd::char8 > &str, xtd::size index)
Initializes a new instance of xtd::basic_string with specified substring at index.
Definition basic_string.hpp:235
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:1168
static basic_string class_name(const object_t &object)
Gets the class name of the specified object.
Definition basic_string.hpp:2023
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:1366
basic_string(const xtd::char32 *str, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified string to copy, and allocator.
Definition basic_string.hpp:579
constexpr basic_string(const string_view_like_t &string_view)
Initializes a new instance of xtd::basic_string with specified string view of substring and allocator...
Definition basic_string.hpp:776
allocator_type get_allocator() const
Returns the allocator associated with the string.
Definition basic_string.hpp:1394
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:1457
basic_string(xtd::char16 character, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:491
basic_string(const xtd::char16 *str, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring, count characters and alloca...
Definition basic_string.hpp:654
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:1450
basic_string trim() const noexcept
Removes all leading and trailing occurrences of white-space characters from the specified xtd::basic_...
Definition basic_string.hpp:1962
xtd::array< basic_string > split() const noexcept
Splits this basic_string into substrings that are based on the default white-space characters....
const_reverse_iterator rbegin() const
Returns a reverse iterator to the first character of the string.
Definition basic_string.hpp:918
basic_string(xtd::size count, xtd::char8 character)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:456
basic_string(std::initializer_list< xtd::char16 > il, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified initializer list and allocator.
Definition basic_string.hpp:822
basic_string(const xtd::char8 *str, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified string to copy, and allocator.
Definition basic_string.hpp:588
basic_string(const xtd::char32 *str)
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:538
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:1220
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...
typename base_type::allocator_type allocator_type
Represents the basic string allocator type.
Definition basic_string.hpp:84
basic_string substring(xtd::size start_index, xtd::size length) const
Retrieves a substring from this instance. The substring starts at a specified character position and ...
Definition basic_string.hpp:1873
basic_string(char character, xtd::size count)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:477
basic_string(const xtd::char16 *str, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified string to copy, and allocator.
Definition basic_string.hpp:571
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:1346
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:1151
basic_string(std::initializer_list< char > il, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified initializer list and allocator.
Definition basic_string.hpp:818
basic_string(const char *str, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring and count characters.
Definition basic_string.hpp:605
enumerator_type get_enumerator() const noexcept override
Returns an enumerator that iterates through a collection.
Definition basic_string.hpp:1404
static basic_string demangle(const basic_string &name)
Gets demangled basic_string of name,.
Definition basic_string.hpp:2211
basic_string(xtd::wchar character, xtd::size count)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:515
basic_string(input_iterator_t first, input_iterator_t last, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified first and last iterators of substring ...
Definition basic_string.hpp:770
basic_string(xtd::size count, xtd::char8 character, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:461
int32 compare(size_type pos1, size_type count1, const basic_string &str) const
Compares two character sequences.
Definition basic_string.hpp:977
typename xtd::collections::generic::enumerator< value_type > enumerator_type
Represents the basic string enumerator type.
Definition basic_string.hpp:108
size_type rfind(const_pointer s, size_type pos, size_type count) const
Finds the last substring that is equal to the given character sequence. The search begins at pos and ...
Definition basic_string.hpp:1680
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:1390
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:1686
size_type rfind(const basic_string &str) const
Finds the last substring that is equal to the given character sequence. The search begins at xtd::bas...
Definition basic_string.hpp:1666
basic_string(const basic_string< xtd::char8 > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:153
basic_string(xtd::wchar character, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:520
basic_string(const basic_string< xtd::char8 > &str, xtd::size index, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring at index and count character...
Definition basic_string.hpp:340
basic_string(const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified allocator.
static bool try_parse(const basic_string &str, value_t &value) noexcept
Try to convert a basic_string into a value_t type.
Definition basic_string.hpp:2409
basic_string(input_iterator_t first, input_iterator_t last)
Initializes a new instance of xtd::basic_string with specified first and last iterators of substring.
Definition basic_string.hpp:764
virtual const base_type & get_base_type() const noexcept
Returns the underlying base type.
Definition basic_string.hpp:1398
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:1291
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:1514
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:1328
basic_string(const basic_string< xtd::wchar > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:198
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:2274
typename base_type::const_pointer const_pointer
Represents the basic string const pointer type.
Definition basic_string.hpp:96
friend std::basic_istream< char > & operator>>(std::basic_istream< char > &stream, basic_string &str)
Input stream operator. Behaves as a FormattedInputFunction. After constructing and checking the sentr...
Definition basic_string.hpp:3646
basic_string(std::initializer_list< xtd::wchar > il)
Initializes a new instance of xtd::basic_string with specified initializer list.
Definition basic_string.hpp:813
int32 compare(size_type pos1, size_type count1, const_pointer s) const
Compares two character sequences.
Definition basic_string.hpp:1067
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:1335
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:1264
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
Concatenates four specified instances of object.
Definition basic_string.hpp:2119
bool starts_with(const basic_string &value) const noexcept
Determines whether the beginning of this instance of xtd::basic_string matches a specified xtd::basic...
Definition basic_string.hpp:1818
basic_string(xtd::char8 character, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:510
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:1122
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:1226
static bool equals(const basic_string &a, const basic_string &b, bool ignore_case) noexcept
Determines whether two specified xtd::basic_string objects have the same value, ignoring or honoring ...
Definition basic_string.hpp:2236
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:1492
basic_string(const basic_string< xtd::char16 > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:140
basic_string(basic_string &&str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to move and allocator.
Definition basic_string.hpp:422
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:1247
basic_string to_upper() const noexcept
Returns a copy of the current xtd::basic_string converted to uppercase.
Definition basic_string.hpp:1945
int32 compare(size_type pos1, size_type count1, const_pointer s, size_type count2) const
Compares two character sequences.
Definition basic_string.hpp:1090
basic_string(const std::basic_string< char > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:691
typename base_type::traits_type traits_type
Represents the basic string traits type.
Definition basic_string.hpp:80
const base_type & chars() const noexcept
Returns a reference to the underlying base type.
Definition basic_string.hpp:875
basic_string trim_start(value_type trim_char) const noexcept
Removes all leading occurrences of a character specified from the specified xtd::basic_string .
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:1521
basic_string(const std::basic_string< xtd::char16 > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:732
static basic_string join(const basic_string &separator, const collection_t &values, xtd::size index, xtd::size count)
Concatenates a specified separator basic_string between each element of a specified Object array,...
Definition basic_string.hpp:2313
basic_string substring(xtd::size start_index) const
Retrieves a substring from this instance. The substring starts at a specified character position and ...
Definition basic_string.hpp:1864
typename base_type::pointer pointer
Represents the basic string pointer type.
Definition basic_string.hpp:94
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...
basic_string(char character, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:482
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:1296
basic_string substr(size_type pos, size_type count) const
Returns a substring [pos, pos + count). If the requested substring extends past the end of the string...
Definition basic_string.hpp:1854
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:1113
xtd::array< value_type > to_char_array() const noexcept
Copies the characters in this instance to a Unicode character array.
basic_string quoted() const
Allows insertion and extraction of quoted strings, such as the ones found in CSV or XML.
Definition basic_string.hpp:1602
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)
Compares substrings of two specified basic_string objects using the specified rules,...
Definition basic_string.hpp:2103
basic_string< char > to_string() const noexcept override
Converts the value of this instance to a xtd::basic_string <char>.
Definition basic_string.hpp:1911
typename base_type::const_reference const_reference
Represents the basic string const referecne type.
Definition basic_string.hpp:92
basic_string(std::initializer_list< xtd::char32 > il)
Initializes a new instance of xtd::basic_string with specified initializer list.
Definition basic_string.hpp:805
static basic_string join(const basic_string &separator, const collection_t &values, xtd::size index)
Concatenates a specified separator basic_string between each element of a specified object array,...
Definition basic_string.hpp:2303
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:1196
basic_string< xtd::wchar > to_wstring() const noexcept
Converts the value of this instance to a xtd::basic_string <xtd::wchar>.
Definition basic_string.hpp:1953
basic_string(const std::basic_string< xtd::char16 > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:697
basic_string(const xtd::wchar *str, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring and count characters.
Definition basic_string.hpp:635
basic_string(const basic_string< xtd::char8 > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:190
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:1623
basic_string(const basic_string< xtd::wchar > &str, xtd::size index)
Initializes a new instance of xtd::basic_string with specified substring at index.
Definition basic_string.hpp:245
const_iterator begin() const override
Returns an iterator to the first character of the string.
Definition basic_string.hpp:849
friend std::basic_ostream< char > & operator<<(std::basic_ostream< char > &stream, const basic_string &str)
Output stream operator. Behaves as a FormattedOutputFunction. After constructing and checking the sen...
Definition basic_string.hpp:3626
basic_string(const basic_string< xtd::wchar > &str, xtd::size index, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring at index and count character...
Definition basic_string.hpp:351
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:1384
const_iterator end() const override
Returns an iterator to the character following the last character of the string. This character acts ...
Definition basic_string.hpp:900
constexpr basic_string(const string_view_like_t &string_view, size_type index, size_type count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified string view of substring and allocator...
Definition basic_string.hpp:795
basic_string(std::initializer_list< xtd::char32 > il, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified initializer list and allocator.
Definition basic_string.hpp:826
basic_string(const basic_string< xtd::char32 > &str, xtd::size index, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index,...
Definition basic_string.hpp:385
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:1628
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:1529
static basic_string class_name()
Gets the class name of the object_t.
Definition basic_string.hpp:2016
static basic_string class_name(const std::type_info &info)
Gets the class name of the specified object.
Definition basic_string.hpp:2029
const_iterator cend() const override
Returns an iterator to the character following the last character of the string. This character acts ...
Definition basic_string.hpp:879
basic_string(xtd::size count, xtd::wchar character)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:466
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:1372
basic_string trim_start(const xtd::array< value_type > &trim_chars) const noexcept
Removes all leading occurrences of a set of characters specified in an array from the specified xtd::...
basic_string(const basic_string< xtd::wchar > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:160
static bool equals(const basic_string &a, const basic_string &b) noexcept
Determines whether two specified xtd::basic_string objects have the same value.
Definition basic_string.hpp:2221
bool is_empty() const noexcept
Indicates whether this basic_string is an empty basic_string ("").
Definition basic_string.hpp:1503
basic_string(const std::basic_string< char > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:725
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:1208
size_type rfind(value_type ch, size_type pos) const
Finds the last substring that is equal to the given character sequence. The search begins at pos and ...
Definition basic_string.hpp:1704
static int32 compare(const basic_string &str_a, const basic_string &str_b, bool ignore_case) noexcept
Compares two specified basic_string objects, ignoring or honoring their case, and returns an integer ...
Definition basic_string.hpp:2051
static int32 compare(const basic_string &str_a, const basic_string &str_b) noexcept
Compares two specified basic_string objects and returns an integer that indicates their relative posi...
Definition basic_string.hpp:2040
typename xtd::collections::generic::ienumerable< char_t >::iterator iterator
Represents the basic string iterator type.
Definition basic_string.hpp:99
basic_string(const basic_string< xtd::char32 > &str, xtd::size index)
Initializes a new instance of xtd::basic_string with specified substring at index.
Definition basic_string.hpp:225
typename base_type::const_reverse_iterator const_reverse_iterator
Represents the basic string const reverse iterator type.
Definition basic_string.hpp:106
static basic_string concat(const basic_string &str_a, const basic_string &str_b, const basic_string &str_c) noexcept
Concatenates three specified instances of basic_string.
Definition basic_string.hpp:2125
basic_string(const basic_string< xtd::char16 > &str, xtd::size index, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring at index and count character...
Definition basic_string.hpp:319
basic_string(const char *str)
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:524
basic_string(const basic_string< xtd::char16 > &str, xtd::size index, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index and allocator.
Definition basic_string.hpp:266
size_type max_size() const noexcept
Returns the maximum number of elements the string is able to hold due to system or library implementa...
Definition basic_string.hpp:914
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:1607
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:1101
basic_string(const basic_string< xtd::char16 > &str, xtd::size index)
Initializes a new instance of xtd::basic_string with specified substring at index.
Definition basic_string.hpp:216
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:1596
basic_string(xtd::char32 character, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:500
basic_string(const xtd::char8 *str, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring, count characters and alloca...
Definition basic_string.hpp:673
int32 compare(size_type pos1, size_type count1, const basic_string &str, size_type pos2, size_type count2) const
Compares two character sequences.
Definition basic_string.hpp:1026
basic_string(std::initializer_list< char > il)
Initializes a new instance of xtd::basic_string with specified initializer list.
Definition basic_string.hpp:799
static bool equals(const char_a_t *a, const char_b_t *b, bool ignore_case) noexcept
Determines whether two specified xtd::basic_string objects have the same value, ignoring or honoring ...
Definition basic_string.hpp:2244
static basic_string concat(object_a_t obj_a, object_b_t obj_b, object_c_t obj_c) noexcept
Concatenates three specified instances of object.
Definition basic_string.hpp:2132
basic_string(const basic_string< char > &str, xtd::size index, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index and allocator.
Definition basic_string.hpp:256
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:1645
basic_string(const basic_string< xtd::char16 > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:175
xtd::size get_hash_code() const noexcept override
Returns the hash code for this basic_string.
Definition basic_string.hpp:1402
bool starts_with(value_type value, bool ignore_case) const noexcept
Determines whether the beginning of this instance of xtd::basic_string matches a specified xtd::basic...
Definition basic_string.hpp:1810
typename base_type::size_type size_type
Represents the basic string size type.
Definition basic_string.hpp:86
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:1118
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:1352
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:1270
bool ends_with(value_type value) const noexcept
Determines whether the end of this basic_string matches the specified character.
Definition basic_string.hpp:1146
basic_string(const basic_string< xtd::wchar > &str, xtd::size index, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index and allocator.
Definition basic_string.hpp:298
size_type rfind(value_type ch) const
Finds the last substring that is equal to the given character sequence. The search begins at xtd::bas...
Definition basic_string.hpp:1698
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
Concatenates four specified instances of basic_string.
Definition basic_string.hpp:2111
static basic_string join(const basic_string separator, const collection_t &values) noexcept
Concatenates a specified separator basic_string between each element of a specified object array,...
Definition basic_string.hpp:2288
const_reverse_iterator crend() const
Returns a reverse iterator to the character following the last character of the string....
Definition basic_string.hpp:883
basic_string(xtd::char8 character, xtd::size count)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:505
basic_string(const xtd::wchar *str)
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:554
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:1543
basic_string(const char *str, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified string to copy, and allocator.
Definition basic_string.hpp:563
basic_string & operator=(const basic_string< char > &str) noexcept
Copy assignment operator. Replaces the contents with a copy of the contents of str.
Definition basic_string.hpp:2438
const_reverse_iterator crbegin() const
Returns a reverse iterator to the first character of the string.
Definition basic_string.hpp:871
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:1234
basic_string(const basic_string< xtd::char8 > &str, xtd::size index, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index and allocator.
Definition basic_string.hpp:287
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:1437
basic_string(const basic_string< xtd::char32 > &str, xtd::size index, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index and allocator.
Definition basic_string.hpp:276
const_pointer data() const noexcept
Returns a pointer to the underlying array serving as character storage. The pointer is such that the ...
Definition basic_string.hpp:892
basic_string(basic_string &&)=default
Initializes a new instance of xtd::basic_string with specified string to move.
static constexpr size_type npos
This is a special value equal to the maximum value representable by the type xtd::size.
Definition basic_string.hpp:119
static basic_string concat(const basic_string &str_a, const basic_string &str_b) noexcept
Concatenates two specified instances of basic_string.
Definition basic_string.hpp:2137
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:1176
basic_string trim_end() const noexcept
Removes all trailing occurrences of white-space characters from the specified xtd::basic_string.
Definition basic_string.hpp:1978
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...
static bool equals(const char_a_t *a, const char_b_t *b) noexcept
Determines whether two specified xtd::basic_string objects have the same value.
Definition basic_string.hpp:2228
static int32 compare(const basic_string &str_a, xtd::size index_a, const basic_string &str_b, xtd::size index_b, xtd::size length)
Compares substrings of two specified basic_string objects and returns an integer that indicates their...
Definition basic_string.hpp:2075
const_reverse_iterator rend() const
Returns a reverse iterator to the character following the last character of the string....
Definition basic_string.hpp:922
basic_string(const basic_string< char > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:133
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:1425
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:1302
basic_string(xtd::char16 character, xtd::size count)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:486
int32 compare(const_pointer s) const
Compares two character sequences.
Definition basic_string.hpp:1045
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:1127
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:1252
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:1284
size_type size() const noexcept
Returns the number of char_t elements in the string, i.e. std::distance(begin(), end()).
Definition basic_string.hpp:926
const_reference at(size_type pos) const
Returns a reference to the character at specified location pos.
Definition basic_string.hpp:935
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:1278
basic_string(const basic_string< char > &str, xtd::size index, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring at index and count character...
Definition basic_string.hpp:309
basic_string substr(size_type pos) const
Returns a substring [pos, pos + count). If the requested substring extends past the end of the string...
Definition basic_string.hpp:1844
basic_string to_title_case() const noexcept
Converts the current basic_string to title case (except for words that are entirely in uppercase,...
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:1639
size_type length() const noexcept
Gets the number of characters in the current xtd::basic_string object.
Definition basic_string.hpp:910
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:1163
basic_string(xtd::size count, xtd::char32 character)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:446
basic_string(xtd::size count, xtd::wchar character, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:472
basic_string(const std::basic_string< xtd::char32 > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:739
static basic_string concat(const xtd::array< object_t > &args) noexcept
Concatenates the basic_string representations of the elements in a specified object array.
basic_string(const char *str, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring, count characters and alloca...
Definition basic_string.hpp:645
static bool is_empty(const xtd::basic_string< value_type, traits_type, allocator_type > &string) noexcept
Indicates whether the specifeid basic_string is an empty basic_string ("").
Definition basic_string.hpp:2279
constexpr basic_string(const string_view_like_t &string_view, size_type index, size_type count)
Initializes a new instance of xtd::basic_string with specified string view of substring and allocator...
Definition basic_string.hpp:788
basic_string(xtd::size count, char character, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:433
basic_string(const xtd::char16 *str)
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:531
basic_string & operator+=(const basic_string< char > &str)
Addition assignment operator. Appends additional characters to the string.
Definition basic_string.hpp:2739
typename base_type::value_type value_type
Represents the basic string value type.
Definition basic_string.hpp:82
typename base_type::reverse_iterator reverse_iterator
Represents the basic string reverse iterator type.
Definition basic_string.hpp:104
basic_string(const xtd::char16 *str, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring and count characters.
Definition basic_string.hpp:612
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:1138
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:1589
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:1314
static basic_string full_class_name()
Gets the fully qualified class name of the objec_t, including the namespace of the objec_t.
Definition basic_string.hpp:2261
basic_string(std::initializer_list< xtd::char16 > il)
Initializes a new instance of xtd::basic_string with specified initializer list.
Definition basic_string.hpp:802
basic_string trim_end(value_type trim_char) const noexcept
Removes all trailing occurrences of a character specified from the specified xtd::basic_string .
basic_string(xtd::size count, xtd::char16 character)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:437
int32 compare(size_type pos1, size_type count1, const basic_string &str, size_type pos2) const
Compares two character sequences.
Definition basic_string.hpp:1001
static basic_string concat(value_t value) noexcept
Creates the basic_string representation of a specified object.
Definition basic_string.hpp:2187
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...
basic_string(std::initializer_list< xtd::char8 > il)
Initializes a new instance of xtd::basic_string with specified initializer list.
Definition basic_string.hpp:809
static basic_string concat(const xtd::array< basic_string > &values) noexcept
Concatenates the elements of a specified basic_string array.
const_reference front() const
Returns reference to the first character in the string. The behavior is undefined if empty() is true.
Definition basic_string.hpp:905
basic_string trim_start() const noexcept
Removes all leading occurrences of white-space characters from the specified xtd::basic_string.
Definition basic_string.hpp:1994
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:1158
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:1240
basic_string()=default
Initializes a new instance of xtd::basic_string.
basic_string(const basic_string< xtd::char32 > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:182
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:2268
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:1508
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:1582
basic_string(const xtd::char32 *str, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring, count characters and alloca...
Definition basic_string.hpp:663
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:1132
bool starts_with(value_type value) const noexcept
Determines whether the beginning of this instance of xtd::basic_string matches a specified xtd::basic...
Definition basic_string.hpp:1804
const_iterator cbegin() const override
Returns an iterator to the first character of the string.
Definition basic_string.hpp:867
basic_string(xtd::size count, char character)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:428
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:1340
basic_string(const xtd::char8 *str)
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:546
basic_string(std::initializer_list< xtd::char8 > il, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified initializer list and allocator.
Definition basic_string.hpp:831
size_type rfind(const basic_string &str, size_type pos) const
Finds the last substring that is equal to the given character sequence. The search begins at pos and ...
Definition basic_string.hpp:1672
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)
Compares substrings of two specified basic_string objects, ignoring or honoring their case,...
Definition basic_string.hpp:2089
basic_string(const basic_string< xtd::wchar > &str, xtd::size index, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index,...
Definition basic_string.hpp:409
basic_string trim(const xtd::array< value_type > &trim_chars) const noexcept
Removes all leading and trailing occurrences of a set of characters specified in an array from the sp...
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:1379
basic_string< xtd::char8 > to_u8string() const noexcept
Converts the value of this instance to a xtd::basic_string <xtd::char8>.
Definition basic_string.hpp:1937
basic_string(xtd::char32 character, xtd::size count)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:495
basic_string(const basic_string< xtd::char8 > &str, xtd::size index, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index,...
Definition basic_string.hpp:397
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:1214
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:1308
int32 compare(const basic_string &str) const
Compares two character sequences.
Definition basic_string.hpp:955
const_pointer c_str() const noexcept
Returns a pointer to a null-terminated character array with data equivalent to those stored in the st...
Definition basic_string.hpp:859
bool empty() const noexcept
Checks if the string has no characters, i.e. whether begin() == end().
Definition basic_string.hpp:896
basic_string(const xtd::wchar *str, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring, count characters and alloca...
Definition basic_string.hpp:683
typename base_type::reference reference
Represents the basic string referecne type.
Definition basic_string.hpp:90
basic_string(std::initializer_list< xtd::wchar > il, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified initializer list and allocator.
Definition basic_string.hpp:836
basic_string(const std::basic_string< xtd::wchar > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:717
basic_string(const xtd::wchar *str, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified string to copy, and allocator.
Definition basic_string.hpp:597
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:1322
basic_string(const std::basic_string< xtd::char8 > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:747
typename xtd::collections::generic::ienumerable< char_t >::const_iterator const_iterator
Represents the basic string const iterator type.
Definition basic_string.hpp:102
constexpr basic_string(const string_view_like_t &string_view, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified string view of substring and allocator...
Definition basic_string.hpp:781
basic_string substr() const
Returns a substring [pos, pos + count). If the requested substring extends past the end of the string...
Definition basic_string.hpp:1838
typename base_type::difference_type difference_type
Represents the basic string difference type.
Definition basic_string.hpp:88
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:1358
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:1182
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:1430
basic_string(const std::basic_string< xtd::char32 > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:703
friend basic_string operator+(const basic_string &lhs, const basic_string< char > &rhs)
Addition operator. Returns a string containing characters from lhs followed by the characters from rh...
Definition basic_string.hpp:2943
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:1258
basic_string(const xtd::char32 *str, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring and count characters.
Definition basic_string.hpp:619
basic_string(const std::basic_string< xtd::char8 > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:710
basic_string(const basic_string< char > &str, xtd::size index, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index,...
Definition basic_string.hpp:363
bool starts_with(const basic_string &value, bool ignore_case) const noexcept
Determines whether the beginning of this instance of xtd::basic_string matches a specified xtd::basic...
Definition basic_string.hpp:1824
basic_string(const basic_string< xtd::char16 > &str, xtd::size index, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index,...
Definition basic_string.hpp:374
basic_string(const std::basic_string< xtd::wchar > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:755
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:1613
basic_string(const basic_string< char > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:168
basic_string< xtd::char16 > to_u16string() const noexcept
Converts the value of this instance to a xtd::basic_string <xtd::char16>.
Definition basic_string.hpp:1922
basic_string(xtd::size count, xtd::char32 character, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:451
xtd::array< value_type > to_array() const noexcept
Copies the characters in this instance to a Unicode character array.
basic_string< xtd::char32 > to_u32string() const noexcept
Converts the value of this instance to a xtd::basic_string <xtd::char32>.
Definition basic_string.hpp:1929
const_reference operator[](xtd::size index) const
Returns a reference to the character at specified location index.
Definition basic_string.hpp:2426
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:1535
bool starts_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:1829
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:1190
size_type capacity() const noexcept
Returns the number of characters that the string has currently allocated space for.
Definition basic_string.hpp:863
const_reference back() const
Returns reference to the last character in the string.
Definition basic_string.hpp:845
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:1203
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:1693
virtual iterator end()
Returns an iterator to the element following the last element of the enumarable.
Definition enumerable_iterators.hpp:173
virtual const_iterator end() const
Returns an iterator to the element following the last element of the enumarable.
Definition enumerable_iterators.hpp:170
virtual const_iterator begin() const
Returns an iterator to the first element of the enumarable.
Definition enumerable_iterators.hpp:155
virtual const_iterator cbegin() const
Returns an iterator to the first element of the enumarable.
Definition enumerable_iterators.hpp:162
virtual const_iterator cend() const
Returns an iterator to the element following the last element of the enumarable.
Definition enumerable_iterators.hpp:166
virtual iterator begin()
Returns an iterator to the first element of the enumarable.
Definition enumerable_iterators.hpp:158
size_t count() const noexcept
Returns the number of elements in current sequence.
Definition enumerable.hpp:209
Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Definition ienumerable.hpp:36
typename xtd::collections::generic::extensions::enumerable_iterators< type_t, xtd::collections::generic::ienumerable< type_t > >::iterator iterator
Represents the iterator of xtd::collections::generic::ienumerable value type.
Definition ienumerable.hpp:44
typename xtd::collections::generic::extensions::enumerable_iterators< type_t, xtd::collections::generic::ienumerable< type_t > >::const_iterator const_iterator
Represents the const iterator of xtd::collections::generic::ienumerable value type.
Definition ienumerable.hpp:46
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
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
Contains xtd::collections::generic::ienumerable <type_t> interface.
static basic_string sprintf(const basic_string &fmt, args_t &&... args) noexcept
Writes the text representation of the specified arguments list, to basic_string using the specified f...
Definition basic_string.hpp:2402
static basic_string format(const basic_string< char > &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
@ argument
The argument is not valid.
@ index_out_of_range
The index is out of range.
@ argument_out_of_range
The argument is out of range.
@ null_pointer
The pointer is null.
char8_t char8
Represents a 8-bit unicode character.
Definition char8.hpp:27
wchar_t wchar
Represents a wide character.
Definition wchar.hpp:24
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
null_ptr null
Represents a null pointer value.
char16_t char16
Represents a 16-bit unicode character.
Definition char16.hpp:26
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
char32_t char32
Represents a 32-bit unicode character.
Definition char32.hpp:26
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
@ ordinal
Compare strings using ordinal (binary) sort rules.
@ ordinal_ignore_case
Compare strings using ordinal (binary) sort rules and ignoring the case of the strings being compared...
@ s
The S key.
@ a
The A key.
@ c
The C key.
@ i
The I key.
@ b
The B key.
@ separator
The Separator key.
@ escape
The ESC (ESCAPE) key.
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 xtd_about_box.hpp:10
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.