xtd 0.2.0
Loading...
Searching...
No Matches
basic_string.hpp
Go to the documentation of this file.
1
4#pragma once
6#define __XTD_CORE_INTERNAL__
11#undef __XTD_CORE_INTERNAL__
12#define __XTD_STD_INTERNAL__
14#undef __XTD_STD_INTERNAL__
17#include "hash_code.hpp"
18#include "icomparable.hpp"
19#include "iequatable.hpp"
20#include "null.hpp"
21#include "string_comparison.hpp"
23#include "types.hpp"
24#include "object.hpp"
25#include "parse.hpp"
26#include "types.hpp"
27#include "unused.hpp"
28#include <cctype>
29#include <iomanip>
30#include <ostream>
31#include <sstream>
32#include <string>
33
35template<class ...args_t>
36void __basic_string_extract_format_arg(const std::locale& loc, xtd::basic_string<char>& fmt, xtd::array<__format_information<char >> & formats, args_t&&... args);
37template<class target_t, class source_t>
38std::basic_string<target_t> __xtd_convert_to_string(std::basic_string<source_t>&& str) noexcept;
39template<class target_t, class source_t>
40std::basic_string<target_t> __xtd_convert_to_string(const std::basic_string<source_t>& str) noexcept;
41std::basic_string<char> __xtd_demangle(const std::basic_string<char>& value) noexcept;
42std::basic_string<char> __xtd_get_class_name(const std::type_info& value) noexcept;
43std::basic_string<char> __xtd_get_full_class_name(const std::type_info& value) noexcept;
45
47namespace xtd {
66 template<class char_t, class traits_t, class allocator_t>
67 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> {
68 public:
70
74 using base_type = std::basic_string<char_t, traits_t, allocator_t>;
76 using traits_type = typename base_type::traits_type;
78 using value_type = typename base_type::value_type;
80 using allocator_type = typename base_type::allocator_type;
82 using size_type = typename base_type::size_type;
84 using difference_type = typename base_type::difference_type;
86 using reference = typename base_type::reference;
88 using const_reference = typename base_type::const_reference;
90 using pointer = typename base_type::pointer;
92 using const_pointer = typename base_type::const_pointer;
100 using reverse_iterator = typename base_type::reverse_iterator;
102 using const_reverse_iterator = typename base_type::const_reverse_iterator;
104 using enumerator_type = typename xtd::collections::generic::enumerator<value_type>;
106
108
112 static const basic_string empty_string;
113
122 inline static constexpr size_type npos = base_type::npos;
123
132 static inline constexpr xtd::size bpos = 0;
133
150 static inline constexpr xtd::size epos = npos - 1;
152
154
157 basic_string() = default;
160 explicit basic_string(const allocator_type & allocator) noexcept;
161
164 basic_string(const basic_string<char>& str) noexcept {
165 if constexpr(std::is_same_v<char, char_t>) chars_ = str.chars_;
166 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
167 }
168
171 basic_string(const basic_string<xtd::char16>& str) noexcept {
172 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = str.chars_;
173 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
174 }
177 basic_string(const basic_string<xtd::char32>& str) noexcept {
178 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = str.chars_;
179 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
180 }
183 basic_string(const basic_string<xtd::char8>& str) noexcept {
184 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = str.chars_;
185 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
186 }
189 basic_string(const basic_string<xtd::wchar>& str) noexcept {
190 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = str.chars_;
191 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
192 }
193
197 basic_string(const basic_string<char>& str, const allocator_type & allocator) noexcept {
198 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, allocator);
199 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
200 }
204 basic_string(const basic_string<xtd::char16>& str, const allocator_type & allocator) noexcept {
205 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, allocator);
206 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
207 }
211 basic_string(const basic_string<xtd::char32>& str, const allocator_type & allocator) noexcept {
212 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, allocator);
213 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
214 }
218 basic_string(const basic_string<xtd::char8>& str, const allocator_type & allocator) noexcept {
219 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, allocator);
220 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
221 }
225 basic_string(const basic_string<xtd::wchar>& str, const allocator_type & allocator) noexcept {
226 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, allocator);
227 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
228 }
229
234 basic_string(const basic_string<char>& str, xtd::size index) {
236 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index);
237 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index)));
238 }
245 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index);
246 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index)));
247 }
254 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index);
255 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index)));
256 }
263 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index);
264 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index)));
265 }
272 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index);
273 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index)));
274 }
275
281 basic_string(const basic_string<char>& str, xtd::size index, const allocator_type & allocator) {
283 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index, allocator);
284 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index)), allocator);
285 }
291 basic_string(const basic_string<xtd::char16>& str, xtd::size index, const allocator_type & allocator) {
293 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index, allocator);
294 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index)), allocator);
295 }
301 basic_string(const basic_string<xtd::char32>& str, xtd::size index, const allocator_type & allocator) {
303 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index, allocator);
304 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index)), allocator);
305 }
311 basic_string(const basic_string<xtd::char8>& str, xtd::size index, const allocator_type & allocator) {
313 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index, allocator);
314 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index)), allocator);
315 }
321 basic_string(const basic_string<xtd::wchar>& str, xtd::size index, const allocator_type & allocator) {
323 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index, allocator);
324 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index)), allocator);
325 }
326
334 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index, count);
335 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index, count)));
336 }
344 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index, count);
345 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index, count)));
346 }
354 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index, count);
355 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index, count)));
356 }
364 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index, count);
365 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index, count)));
366 }
374 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index, count);
375 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index, count)));
376 }
377
384 basic_string(const basic_string<char>& str, xtd::size index, xtd::size count, const allocator_type & allocator) {
386 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
387 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index, count)), allocator);
388 }
395 basic_string(const basic_string<xtd::char16>& str, xtd::size index, xtd::size count, const allocator_type & allocator) {
397 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
398 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index, count)), allocator);
399 }
406 basic_string(const basic_string<xtd::char32>& str, xtd::size index, xtd::size count, const allocator_type & allocator) {
408 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
409 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index, count)), allocator);
410 }
417 basic_string(const basic_string<xtd::char8>& str, xtd::size index, xtd::size count, const allocator_type & allocator) {
419 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
420 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index, count)), allocator);
421 }
428 basic_string(const basic_string<xtd::wchar>& str, xtd::size index, xtd::size count, const allocator_type & allocator) {
430 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
431 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index, count)), allocator);
432 }
433
436 basic_string(basic_string&&) = default;
437
441 basic_string(basic_string&& str, const allocator_type & allocator) noexcept : chars_(std::move(str.chars_)) {}
442
447 basic_string(xtd::size count, char character) : basic_string(std::basic_string<char>(count, character)) {}
452 basic_string(xtd::size count, char character, const allocator_type & allocator) : basic_string(std::basic_string<char>(count, character), allocator) {}
456 basic_string(xtd::size count, xtd::char16 character) : basic_string(std::basic_string<xtd::char16>(count, character)) {}
461 basic_string(xtd::size count, xtd::char16 character, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char16>(count, character), allocator) {}
465 basic_string(xtd::size count, xtd::char32 character) : basic_string(std::basic_string<xtd::char32>(count, character)) {}
470 basic_string(xtd::size count, xtd::char32 character, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char32>(count, character), allocator) {}
474 basic_string(xtd::size count, xtd::char8 character) : basic_string(std::basic_string<xtd::char8>(count, character)) {}
479 basic_string(xtd::size count, xtd::char8 character, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char8>(count, character), allocator) {}
483 basic_string(xtd::size count, xtd::wchar character) : basic_string(std::basic_string<xtd::wchar>(count, character)) {}
489 basic_string(xtd::size count, xtd::wchar character, const allocator_type & allocator) : basic_string(std::basic_string<xtd::wchar>(count, character), allocator) {}
490
494 basic_string(char character, xtd::size count) : basic_string(std::basic_string<char>(count, character)) {}
499 basic_string(char character, xtd::size count, const allocator_type & allocator) : basic_string(std::basic_string<char>(count, character), allocator) {}
503 basic_string(xtd::char16 character, xtd::size count) : basic_string(std::basic_string<xtd::char16>(count, character)) {}
508 basic_string(xtd::char16 character, xtd::size count, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char16>(count, character), allocator) {}
512 basic_string(xtd::char32 character, xtd::size count) : basic_string(std::basic_string<xtd::char32>(count, character)) {}
517 basic_string(xtd::char32 character, xtd::size count, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char32>(count, character), allocator) {}
521 basic_string(xtd::char8 character, xtd::size count) : basic_string(std::basic_string<xtd::char8>(count, character)) {}
526 basic_string(xtd::char8 character, xtd::size count, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char8>(count, character), allocator) {}
530 basic_string(xtd::wchar character, xtd::size count) : basic_string(std::basic_string<xtd::wchar>(count, character)) {}
535 basic_string(xtd::wchar character, xtd::size count, const allocator_type & allocator) : basic_string(std::basic_string<xtd::wchar>(count, character), allocator) {}
536
539 basic_string(const char* str) { // Can't be explicit by design.
541 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str);
542 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str));
543 }
546 basic_string(const xtd::char16 * str) { // Can't be explicit by design.
548 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str);
549 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str));
550 }
553 basic_string(const xtd::char32 * str) { // Can't be explicit by design.
555 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str);
556 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str));
557 }
560 basic_string(const xtd::char8 * str) { // Can't be explicit by design.
562 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str);
563 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str));
564 }
567 basic_string(const xtd::wchar * str) { // Can't be explicit by design.
569 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
570 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
571 }
572
576 basic_string(const char* str, const allocator_type & allocator) {
578 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str, allocator);
579 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str), allocator);
580 }
584 basic_string(const xtd::char16 * str, const allocator_type & allocator) {
586 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str, allocator);
587 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str), allocator);
588 }
592 basic_string(const xtd::char32 * str, const allocator_type & allocator) {
594 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str, allocator);
595 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str), allocator);
596 }
600 basic_string(const xtd::char8 * str, const allocator_type & allocator) {
602 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str, allocator);
603 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str), allocator);
604 }
608 basic_string(const xtd::wchar * str, const allocator_type & allocator) : chars_(allocator) {
610 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
611 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
612 }
613
616 basic_string(const char* str, xtd::size count) {
618 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str, count);
619 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str, count));
620 }
625 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str, count);
626 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str, count));
627 }
632 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str, count);
633 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str, count));
634 }
637 basic_string(const xtd::char8 * str, xtd::size count) {
639 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str, count);
640 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str, count));
641 }
644 basic_string(const xtd::wchar * str, xtd::size count) {
646 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str, count);
647 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str, count));
648 }
649
654 basic_string(const char* str, xtd::size count, const allocator_type & allocator) {
656 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str, count, allocator);
657 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str, count), allocator);
658 }
663 basic_string(const xtd::char16 * str, xtd::size count, const allocator_type & allocator) : chars_(allocator) {
665 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str, count, allocator);
666 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str, count), allocator);
667 }
672 basic_string(const xtd::char32 * str, xtd::size count, const allocator_type & allocator) : chars_(allocator) {
674 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str, count, allocator);
675 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str, count), allocator);
676 }
681 basic_string(const xtd::char8 * str, xtd::size count, const allocator_type & allocator) : chars_(allocator) {
683 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str, count, allocator);
684 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str, count), allocator);
685 }
690 basic_string(const xtd::wchar * str, xtd::size count, const allocator_type & allocator) : chars_(allocator) {
692 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str, count, allocator);
693 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str, count), allocator);
694 }
695
698 basic_string(const std::basic_string<char>& str) noexcept { // Can't be explicit by design.
699 if constexpr(std::is_same_v<char, char_t>) chars_ = str;
700 else chars_ = __xtd_convert_to_string<value_type>(str);
701 }
704 basic_string(const std::basic_string<xtd::char16>& str) noexcept { // Can't be explicit by design.
705 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = str;
706 else chars_ = __xtd_convert_to_string<value_type>(str);
707 }
710 basic_string(const std::basic_string<xtd::char32>& str) noexcept { // Can't be explicit by design.
711 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = str;
712 else chars_ = __xtd_convert_to_string<value_type>(str);
713 }
716 basic_string(const std::basic_string<xtd::char8>& str) noexcept { // Can't be explicit by design.
717 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = str;
718 else chars_ = __xtd_convert_to_string<value_type>(str);
719 }
722 basic_string(const std::basic_string<xtd::wchar>& str) noexcept { // Can't be explicit by design.
723 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = str;
724 else chars_ = __xtd_convert_to_string<value_type>(str);
725 }
726
730 basic_string(const std::basic_string<char>& str, const allocator_type & allocator) noexcept {
731 if constexpr(std::is_same_v<char, char_t>) chars_ = base_type(str, allocator);
732 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
733 }
737 basic_string(const std::basic_string<xtd::char16>& str, const allocator_type & allocator) noexcept {
738 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str, allocator);
739 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
740 }
744 basic_string(const std::basic_string<xtd::char32>& str, const allocator_type & allocator) noexcept {
745 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str, allocator);
746 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
747 }
751 basic_string(const std::basic_string<xtd::char8>& str, const allocator_type & allocator) noexcept {
752 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str, allocator);
753 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
754 }
758 basic_string(const std::basic_string<xtd::wchar>& str, const allocator_type & allocator) noexcept {
759 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str, allocator);
760 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
761 }
762
766 template<class input_iterator_t>
767 basic_string(input_iterator_t first, input_iterator_t last) : chars_(first, last) {}
772 template<class input_iterator_t>
773 basic_string(input_iterator_t first, input_iterator_t last, const allocator_type & allocator) : chars_(first, last, allocator) {}
774
778 template<class string_view_like_t>
779 explicit constexpr basic_string(const string_view_like_t& string_view) : chars_(string_view) {}
783 template<class string_view_like_t>
784 explicit constexpr basic_string(const string_view_like_t& string_view, const allocator_type & allocator) : chars_(string_view, allocator) {}
790 template<class string_view_like_t>
791 constexpr basic_string(const string_view_like_t& string_view, size_type index, size_type count) : chars_(string_view, index, count) {}
797 template<class string_view_like_t>
798 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) {}
799
802 basic_string(std::initializer_list<char> il) : basic_string(std::basic_string<char>(il)) {}
805 basic_string(std::initializer_list<xtd::char16> il) : basic_string(std::basic_string<xtd::char16>(il)) {}
808 basic_string(std::initializer_list<xtd::char32> il) : basic_string(std::basic_string<xtd::char32>(il)) {}
811 basic_string(std::initializer_list<xtd::char8> il) : basic_string(std::basic_string<xtd::char8>(il)) {}
814 basic_string(std::initializer_list<xtd::wchar> il) : basic_string(std::basic_string<xtd::wchar>(il)) {}
815
819 basic_string(std::initializer_list<char> il, const allocator_type & allocator) : basic_string(std::basic_string<char>(il), allocator) {}
823 basic_string(std::initializer_list<xtd::char16> il, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char16>(il), allocator) {}
827 basic_string(std::initializer_list<xtd::char32> il, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char32>(il), allocator) {}
831 basic_string(std::initializer_list<xtd::char8> il, const allocator_type & allocator) : basic_string(std::basic_string<xtd::char8>(il), allocator) {}
835 basic_string(std::initializer_list<xtd::wchar> il, const allocator_type & allocator) : basic_string(std::basic_string<xtd::wchar>(il), allocator) {}
837
839
849 const_pointer c_str() const noexcept {return chars_.c_str();}
852 const base_type & chars() const noexcept {return chars_;}
853
856 base_type & chars() noexcept {return chars_;}
857
861 virtual size_type count() const noexcept {return chars_.size();}
862
870 const_pointer data() const noexcept {return chars_.data();}
871
874 virtual bool empty() const noexcept {return length() == 0;}
875
879 virtual size_type length() const noexcept {return chars_.size();}
880
884 virtual size_type size() const noexcept {return chars_.size();}
886
888
908 int32 compare(const basic_string & str) const {return chars_.compare(str);}
930 int32 compare(size_type pos1, size_type count1, const basic_string & str) const {return chars_.compare(pos1, count1, str);}
954 int32 compare(size_type pos1, size_type count1, const basic_string & str, size_type pos2) const {return chars_.compare(pos1, count1, str, pos2);}
979 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);}
998 int32 compare(const_pointer s) const {return chars_.compare(s);}
1020 int32 compare(size_type pos1, size_type count1, const_pointer s) const {return chars_.compare(pos1, count1, s);}
1043 int32 compare(size_type pos1, size_type count1, const_pointer s, size_type count2) const {return chars_.compare(pos1, count1, s, count2);}
1044
1054 int32 compare_to(const object & value) const {
1056 return compare_to(static_cast<const basic_string&>(value));
1057 }
1058
1066 int32 compare_to(const basic_string & value) const noexcept override {return chars_.compare(value.chars_);}
1067
1071 virtual bool contains(value_type value) const noexcept {return find(value) != npos;}
1075 virtual bool contains(const basic_string & value) const noexcept {return find(value) != npos;}
1076
1080 bool equals(const object & obj) const noexcept override {return dynamic_cast<const basic_string*>(&obj) && equals(static_cast<const basic_string&>(obj));}
1085 bool equals(const basic_string & value) const noexcept override {return equals(value, false);}
1091 bool equals(const basic_string & value, bool ignore_case) const noexcept {
1092 if (ignore_case) return to_upper().chars_ == value.to_upper().chars_;
1093 return chars_ == value.chars_;
1094 }
1095
1099 bool ends_with(value_type value) const noexcept {return ends_with(value, false);}
1104 bool ends_with(value_type value, bool ignore_case) const noexcept {
1105 if (ignore_case) return to_lower().rfind(static_cast<value_type>(tolower(value))) == length() - 1;
1106 return chars_.rfind(value) == length() - 1;
1107 }
1108
1111 bool ends_with(const basic_string & value) const noexcept {return ends_with(value, xtd::string_comparison::ordinal);}
1116 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);}
1121 bool ends_with(const basic_string & value, xtd::string_comparison comparison_type) const noexcept {
1122 if (comparison_type == xtd::string_comparison::ordinal_ignore_case) return to_lower().chars_.rfind(value.to_lower()) + value.to_lower().length() == length();
1123 return chars_.rfind(value) + value.length() == length();
1124 }
1125
1129 size_type find(const basic_string & str) const {return chars_.find(str);}
1135 size_type find(const basic_string & str, size_type pos) const {return chars_.find(str, pos);}
1143 size_type find(const_pointer s, size_type pos, size_type count) const {return chars_.find(s, pos, count);}
1149 size_type find(const_pointer s) const {return chars_.find(s);}
1156 size_type find(const_pointer s, size_type pos) const {return chars_.find(s, pos);}
1161 size_type find(value_type ch) const {return chars_.find(ch);}
1167 size_type find(value_type ch, size_type pos) const {return chars_.find(ch, pos);}
1168
1173 size_type find_first_of(const basic_string & str) const {return chars_.find_first_of(str);}
1179 size_type find_first_of(const basic_string & str, size_type pos) const {return chars_.find_first_of(str, pos);}
1187 size_type find_first_of(const_pointer s, size_type pos, size_type count) const {return chars_.find_first_of(s, pos, count);}
1193 size_type find_first_of(const_pointer s) const {return chars_.find_first_of(s);}
1200 size_type find_first_of(const_pointer s, size_type pos) const {return chars_.find_first_of(s, pos);}
1205 size_type find_first_of(char_t ch) const {return chars_.find_first_of(ch);}
1211 size_type find_first_of(char_t ch, size_type pos) const {return chars_.find_first_of(ch, pos);}
1212
1217 size_type find_first_not_of(const basic_string & str) const {return chars_.find_first_not_of(str);}
1223 size_type find_first_not_of(const basic_string & str, size_type pos) const {return chars_.find_first_not_of(str, pos);}
1231 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);}
1237 size_type find_first_not_of(const_pointer s) const {return chars_.find_first_not_of(s);}
1244 size_type find_first_not_of(const_pointer s, size_type pos) const {return chars_.find_first_not_of(s, pos);}
1249 size_type find_first_not_of(char_t ch) const {return chars_.find_first_not_of(ch);}
1255 size_type find_first_not_of(char_t ch, size_type pos) const {return chars_.find_first_not_of(ch, pos);}
1256
1261 size_type find_last_of(const basic_string & str) const {return chars_.find_last_of(str);}
1267 size_type find_last_of(const basic_string & str, size_type pos) const {return chars_.find_last_of(str, pos);}
1275 size_type find_last_of(const_pointer s, size_type pos, size_type count) const {return chars_.find_last_of(s, pos, count);}
1281 size_type find_last_of(const_pointer s) const {return chars_.find_last_of(s);}
1288 size_type find_last_of(const_pointer s, size_type pos) const {return chars_.find_last_of(s, pos);}
1293 size_type find_last_of(char_t ch) const {return chars_.find_last_of(ch);}
1299 size_type find_last_of(char_t ch, size_type pos) const {return chars_.find_last_of(ch, pos);}
1300
1305 size_type find_last_not_of(const basic_string & str) const {return chars_.find_last_not_of(str);}
1311 size_type find_last_not_of(const basic_string & str, size_type pos) const {return chars_.find_last_not_of(str, pos);}
1319 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);}
1325 size_type find_last_not_of(const_pointer s) const {return chars_.find_last_not_of(s);}
1332 size_type find_last_not_of(const_pointer s, size_type pos) const {return chars_.find_last_not_of(s, pos);}
1337 size_type find_last_not_of(char_t ch) const {return chars_.find_last_not_of(ch);}
1343 size_type find_last_not_of(char_t ch, size_type pos) const {return chars_.find_last_not_of(ch, pos);}
1344
1347 allocator_type get_allocator() const {return chars_.get_allocator();}
1348
1351 virtual const base_type & get_base_type() const noexcept {return chars_;}
1352
1355 xtd::size get_hash_code() const noexcept override {return xtd::hash_code::combine(chars_);}
1356
1357 enumerator_type get_enumerator() const noexcept override {
1358 class basic_string_enumerator : public xtd::collections::generic::ienumerator<value_type> {
1359 public:
1360 explicit basic_string_enumerator(const basic_string & chars) : chars_(chars) {}
1361
1362 const value_type & current() const override {return chars_[index_];}
1363
1364 bool move_next() override {return ++index_ < chars_.length();}
1365
1366 void reset() override {index_ = basic_string::npos;}
1367
1368 protected:
1369 const basic_string& chars_;
1370 xtd::size index_ = basic_string::npos;
1371 };
1373 }
1374
1378 xtd::size index_of(const basic_string & value) const noexcept {return index_of(value, 0, length());}
1383 xtd::size index_of(const basic_string & value, xtd::size start_index) const {return index_of(value, start_index, length() - start_index);}
1390 xtd::size index_of(const basic_string & value, xtd::size start_index, xtd::size count) const {
1392 auto result = find(value, start_index);
1393 return result > start_index + count ? npos : result;
1394 }
1395
1398 xtd::size index_of(value_type value) const noexcept {return index_of(value, 0, length());}
1403 xtd::size index_of(value_type value, xtd::size start_index) const {return index_of(value, start_index, length() - start_index);}
1412 auto result = find(value, start_index);
1413 return result > start_index + count ? npos : result;
1414 }
1415
1419 xtd::size index_of_any(const xtd::array<value_type>& values) const noexcept;
1425 xtd::size index_of_any(const xtd::array<value_type>& values, xtd::size start_index) const;
1434 xtd::size index_of_any(const std::initializer_list<value_type>& values) const noexcept;
1435 xtd::size index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index) const;
1436 xtd::size index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index, xtd::size count) const;
1438
1445 basic_string insert(xtd::size start_index, const basic_string & value) const {
1447 auto result = self_;
1448 result.chars_.insert(start_index, value);
1449 return result;
1450 }
1451
1455 xtd::size last_index_of(const basic_string & value) const noexcept {return last_index_of(value, 0, length());}
1461 xtd::size last_index_of(const basic_string & value, xtd::size start_index) const {return last_index_of(value, start_index, length() - start_index);}
1468 xtd::size last_index_of(const basic_string & value, xtd::size start_index, xtd::size count) const {
1470 auto result = chars_.rfind(value, start_index + count - value.length());
1471 return result < start_index ? npos : result;
1472 }
1473
1476 xtd::size last_index_of(value_type value) const noexcept {return last_index_of(value, 0, length());}
1482 xtd::size last_index_of(value_type value, xtd::size start_index) const {return last_index_of(value, start_index, length() - start_index);}
1492 auto result = chars_.rfind(value, start_index + count - 1);
1493 return result < start_index ? npos : result;
1494 }
1495
1512 xtd::size last_index_of_any(const std::initializer_list<value_type>& values) const noexcept;
1513 xtd::size last_index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index) const;
1514 xtd::size last_index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index, xtd::size count) const;
1516
1522 basic_string pad_left(xtd::size total_width) const noexcept {return pad_left(total_width, ' ');}
1529 basic_string pad_left(xtd::size total_width, char32 padding_char) const noexcept {return total_width < length() ? self_ : basic_string(total_width - length(), padding_char) + self_;}
1530
1536 basic_string pad_right(xtd::size total_width) const noexcept {return pad_right(total_width, ' ');}
1543 basic_string pad_right(xtd::size total_width, char32 padding_char) const noexcept {return total_width < length() ? self_ : self_ + basic_string(total_width - length(), padding_char);}
1544
1549 basic_string quoted() const {return quoted('"', '\\');}
1554 basic_string quoted(value_type delimiter) const {return quoted(delimiter, '\\');}
1561 std::wstringstream ss;
1562 if constexpr(std::is_same_v<xtd::wchar, value_type>) ss << std::quoted(chars_, delimiter, escape);
1563 else ss << std::quoted(__xtd_convert_to_string<xtd::wchar>(chars_), static_cast<xtd::wchar>(delimiter), static_cast<xtd::wchar>(escape));
1564 return ss.str();
1565 }
1566
1570 basic_string remove(xtd::size start_index) const {return remove(start_index, length() - start_index);}
1577 auto result = self_;
1578 result.chars_.erase(start_index, count);
1579 return result;
1580 }
1581
1586 basic_string replace(value_type old_char, value_type new_char) const noexcept {return replace(string(1, old_char), string(1, new_char));}
1592 basic_string replace(const basic_string & old_string, const basic_string & new_string) const noexcept {
1593 auto result = self_;
1594 auto old_size = old_string.length();
1595 auto new_size = new_string.length();
1596 auto index = xtd::size {0};
1597 while (true) {
1598 index = result.find(old_string, index);
1599 if (index == npos) break;
1600 if (old_size == new_size) result.chars_.replace(index, old_size, new_string);
1601 else {
1602 result.chars_.erase(index, old_string.length());
1603 result.chars_.insert(index, new_string);
1604 }
1605 index += new_string.length();
1606 }
1607 return result;
1608 }
1609
1613 size_type rfind(const basic_string & str) const {return chars_.rfind(str);}
1619 size_type rfind(const basic_string & str, size_type pos) const {return chars_.rfind(str, pos);}
1627 size_type rfind(const_pointer s, size_type pos, size_type count) const {return chars_.rfind(s, pos, count);}
1633 size_type rfind(const_pointer s) const {return chars_.rfind(s);}
1640 size_type rfind(const_pointer s, size_type pos) const {return chars_.rfind(s, pos);}
1645 size_type rfind(value_type ch) const {return chars_.rfind(ch);}
1651 size_type rfind(value_type ch, size_type pos) const {return chars_.rfind(ch, pos);}
1652
1657 xtd::array<basic_string> split() const noexcept;
1663 xtd::array<basic_string> split(value_type separator) const noexcept;
1680 xtd::array<basic_string> split(value_type separator, xtd::string_split_options options) const noexcept;
1689 xtd::array<basic_string> split(value_type separator, xtd::size count) const noexcept;
1701 xtd::array<basic_string> split(value_type separator, xtd::size count, xtd::string_split_options options) const noexcept;
1707 xtd::array<basic_string> split(const xtd::array<value_type>& separators) const noexcept;
1724 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::string_split_options options) const noexcept;
1733 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::size count) const noexcept;
1745 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::size count, xtd::string_split_options options) const noexcept;
1746
1751 bool starts_with(value_type value) const noexcept {return starts_with(value, false);}
1757 bool starts_with(value_type value, bool ignore_case) const noexcept {
1758 if (ignore_case) return to_lower().find(static_cast<value_type>(tolower(value))) == 0;
1759 return find(value) == 0;
1760 }
1765 bool starts_with(const basic_string & value) const noexcept {return starts_with(value, string_comparison::ordinal);}
1771 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);}
1776 bool starts_with(const basic_string & value, xtd::string_comparison comparison_type) const noexcept {
1777 if (comparison_type == xtd::string_comparison::ordinal_ignore_case) return to_lower().find(value.to_lower()) == 0;
1778 return find(value) == 0;
1779 }
1780
1785 basic_string substr() const {return chars_.substr();}
1791 basic_string substr(size_type pos) const {
1793 return chars_.substr(pos);
1794 }
1801 basic_string substr(size_type pos, size_type count) const {
1803 return chars_.substr(pos, count);
1804 }
1805
1811 basic_string substring(xtd::size start_index) const {
1813 return substr(start_index);
1814 }
1820 basic_string substring(xtd::size start_index, xtd::size length) const {
1821 if (start_index > self_.length() || start_index + length > self_.length()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range);
1822 return substr(start_index, length);
1823 }
1824
1827 xtd::array<value_type> to_array() const noexcept;
1831 xtd::array<value_type> to_array(xtd::size start_index) const;
1836 xtd::array<value_type> to_array(xtd::size start_index, xtd::size length) const;
1837
1840 xtd::array<value_type> to_char_array() const noexcept;
1845 xtd::array<value_type> to_char_array(xtd::size start_index, xtd::size length) const;
1846
1849 basic_string to_lower() const noexcept {
1850 auto result = basic_string::empty_string;
1851 std::for_each(chars_.begin(), chars_.end(), [&](auto c) {result += static_cast<value_type>(std::tolower(c));});
1852 return result;
1853 }
1854
1858 basic_string<char> to_string() const noexcept override {
1859 if constexpr(std::is_same_v<char, char_t>) return chars_;
1860 else return __xtd_convert_to_string<char>(chars_);
1861 }
1862
1865 basic_string to_title_case() const noexcept;
1866
1869 basic_string<xtd::char16> to_u16string() const noexcept {
1870 if constexpr(std::is_same_v<xtd::char16, char_t>) return chars_;
1871 else return __xtd_convert_to_string<xtd::char16>(chars_);
1872 }
1873
1876 basic_string<xtd::char32> to_u32string() const noexcept {
1877 if constexpr(std::is_same_v<xtd::char32, char_t>) return chars_;
1878 else return __xtd_convert_to_string<xtd::char32>(chars_);
1879 }
1880
1883 basic_string<xtd::char8> to_u8string() const noexcept {
1884 if constexpr(std::is_same_v<xtd::char8, char_t>) return chars_;
1885 else return __xtd_convert_to_string<xtd::char8>(chars_);
1886 }
1887
1890 basic_string to_upper() const noexcept {
1891 auto result = basic_string::empty_string;
1892 std::for_each(chars_.begin(), chars_.end(), [&](auto c) {result += static_cast<value_type>(std::toupper(c));});
1893 return result;
1894 }
1895
1898 basic_string<xtd::wchar> to_wstring() const noexcept {
1899 if constexpr(std::is_same_v<xtd::wchar, char_t>) return chars_;
1900 else return __xtd_convert_to_string<xtd::wchar>(chars_);
1901 }
1902
1907 basic_string trim() const noexcept {return trim(default_trim_chars);}
1912 basic_string trim(value_type trim_char) const noexcept;
1917 basic_string trim(const xtd::array<value_type>& trim_chars) const noexcept;
1918
1923 basic_string trim_end() const noexcept {return trim_end(default_trim_chars);}
1928 basic_string trim_end(value_type trim_char) const noexcept;
1933 basic_string trim_end(const xtd::array<value_type>& trim_chars) const noexcept;
1934
1939 basic_string trim_start() const noexcept {return trim_start(default_trim_chars);}
1944 basic_string trim_start(value_type trim_char) const noexcept;
1949 basic_string trim_start(const xtd::array<value_type>& trim_chars) const noexcept;
1951
1953
1964 static int32 compare(const basic_string & str_a, const basic_string & str_b) noexcept {return compare(str_a, str_b, false);}
1975 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);}
1986 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);}
1999 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);}
2013 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);}
2027 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));}
2028
2035 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;}
2042 template<class object_a_t, class object_b_t, class object_c_t, class object_d_t>
2043 inline 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);}
2049 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;}
2055 template<class object_a_t, class object_b_t, class object_c_t>
2056 inline 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);}
2061 static basic_string concat(const basic_string & str_a, const basic_string & str_b) noexcept {return str_a + str_b;}
2066 template<class object_a_t, class object_b_t>
2067 inline static basic_string concat(object_a_t obj_a, object_b_t obj_b) noexcept {return format("{}{}", obj_a, obj_b);}
2071 static basic_string concat(const xtd::array<basic_string>& values) noexcept;
2073 static basic_string concat(const xtd::array<const_pointer>& values) noexcept;
2074 template<class other_char_t>
2075 inline static basic_string concat(const xtd::array<const other_char_t*>& values) noexcept;
2076 static basic_string concat(const std::initializer_list<basic_string>& values) noexcept {
2077 auto result = basic_string::empty_string;
2078 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2079 return result;
2080 }
2081 static basic_string concat(const std::initializer_list<const_pointer>& values) noexcept {
2082 auto result = basic_string::empty_string;
2083 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2084 return result;
2085 }
2086 template<class other_char_t>
2087 inline static basic_string concat(const std::initializer_list<const other_char_t*>& values) noexcept {
2088 auto result = basic_string::empty_string;
2089 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2090 return result;
2091 }
2096 template<class object_t>
2097 inline static basic_string concat(const xtd::array<object_t>& args) noexcept;
2099 template<class object_t>
2100 inline static basic_string concat(const std::initializer_list<object_t>& args) noexcept {
2101 basic_string result;
2102 for (const auto& arg : args)
2103 result += format("{}", arg);
2104 return result;
2105 }
2110 template<class value_t>
2111 inline static basic_string concat(value_t value) noexcept {
2112 return format("{}", value);
2113 }
2114
2135 static basic_string demangle(const basic_string & name) {
2136 if constexpr(std::is_same_v<char, char_t>) return __xtd_demangle(name.chars());
2137 else return __xtd_demangle(__xtd_convert_to_string<char>(name.chars()));
2138 }
2139
2145 static bool equals(const basic_string & a, const basic_string & b) noexcept{return a.equals(b);}
2151 template<class char_a_t, class char_b_t>
2152 inline static bool equals(const char_a_t* a, const char_b_t* b) noexcept{return basic_string {a}.equals(basic_string {b});}
2153
2160 static bool equals(const basic_string & a, const basic_string & b, bool ignore_case) noexcept {return a.equals(b, ignore_case);}
2167 template<class char_a_t, class char_b_t>
2168 inline 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);}
2169
2176 template<class ...args_t>
2177 inline static basic_string format(const basic_string<char>& fmt, args_t&& ... args);
2178
2186 template<class ...args_t>
2187 inline static basic_string format(const std::locale & loc, const basic_string<char>& fmt, args_t&& ... args);
2188
2192 static bool is_empty(const xtd::basic_string<value_type, traits_type, allocator_type>& string) noexcept {return !string.length();}
2193
2200 template<class collection_t>
2201 inline static basic_string join(const basic_string separator, const collection_t& values) noexcept {
2202 xtd::size i = 0;
2203 basic_string result;
2204 for (const auto& item : values)
2205 result += format("{}{}", (i++ != 0 ? separator : basic_string {}), item);
2206 return result;
2207 }
2215 template<class collection_t>
2216 inline static basic_string join(const basic_string & separator, const collection_t& values, xtd::size index) {return join(separator, values, index, values.size() - index);}
2225 template<class collection_t>
2226 inline static basic_string join(const basic_string & separator, const collection_t& values, xtd::size index, xtd::size count) {
2227 if (index > values.size() || index + count > values.size()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range);
2228 xtd::size i = 0;
2229 basic_string result;
2230 for (const auto& item : values) {
2231 if (i >= index) result += format("{}{}", (i != index ? separator : basic_string {}), item);
2232 if (++i >= index + count) break;
2233 }
2234 return result;
2235 }
2236
2238 template<class value_t>
2239 inline static basic_string join(const basic_string & separator, const std::initializer_list<value_t>& values) noexcept;
2240 template<class value_t>
2241 inline static basic_string join(const basic_string & separator, const std::initializer_list<value_t>& values, xtd::size index);
2242 template<class value_t>
2243 inline static basic_string join(const basic_string & separator, const std::initializer_list<value_t>& values, xtd::size index, xtd::size count);
2245
2249 template<class value_t>
2250 inline static value_t parse(const basic_string & str) {
2251 if constexpr(std::is_same_v<char, char_t>) return xtd::parse<value_t>(str.chars());
2252 else return xtd::parse<value_t>(__xtd_convert_to_string<char>(str.chars()));
2253 }
2254
2314 template<class ...args_t>
2315 inline static basic_string sprintf(const basic_string & fmt, args_t&& ... args) noexcept {return __sprintf(fmt.chars().c_str(), convert_param(std::forward<args_t>(args)) ...);}
2316
2321 template<class value_t>
2322 inline static bool try_parse(const basic_string & str, value_t& value) noexcept {
2323 try {
2324 value = parse<value_t>(str);
2325 return true;
2326 } catch (...) {
2327 return false;
2328 }
2329 }
2331
2333
2339 const_reference operator [](xtd::size index) const {
2341 return chars_[index == epos ? length() - 1 : index];
2342 }
2343
2346 operator const base_type & () const noexcept {return chars_;}
2347
2351 basic_string& operator =(const basic_string<char>& str) noexcept {
2352 if constexpr(std::is_same<char_t, char>::value) chars_ = str.chars_;
2353 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2354 return self_;
2355 }
2359 basic_string& operator =(const basic_string<xtd::char16>& str) noexcept {
2360 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str.chars_;
2361 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2362 return self_;
2363 }
2367 basic_string& operator =(const basic_string<xtd::char32>& str) noexcept {
2368 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str.chars_;
2369 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2370 return self_;
2371 }
2375 basic_string& operator =(const basic_string<xtd::char8>& str) noexcept {
2376 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str.chars_;
2377 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2378 return self_;
2379 }
2383 basic_string& operator =(const basic_string<xtd::wchar>& str) noexcept {
2384 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str.chars_;
2385 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2386 return self_;
2387 }
2388
2392 basic_string& operator =(basic_string<char>&& str) noexcept {
2393 if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str.chars_);
2394 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2395 return self_;
2396 }
2400 basic_string& operator =(basic_string<xtd::char16>&& str) noexcept {
2401 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str.chars_);
2402 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2403 return self_;
2404 }
2408 basic_string& operator =(basic_string<xtd::char32>&& str) noexcept {
2409 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str.chars_);
2410 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2411 return self_;
2412 }
2416 basic_string& operator =(basic_string<xtd::char8>&& str) noexcept {
2417 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str.chars_);
2418 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2419 return self_;
2420 }
2424 basic_string& operator =(basic_string<xtd::wchar>&& str) noexcept {
2425 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str.chars_);
2426 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2427 return self_;
2428 }
2429
2433 basic_string& operator =(const std::basic_string<char>& str) noexcept {
2434 if constexpr(std::is_same<char_t, char>::value) chars_ = str;
2435 else chars_ = __xtd_convert_to_string<value_type>(str);
2436 return self_;
2437 }
2441 basic_string& operator =(const std::basic_string<xtd::char16>& str) noexcept {
2442 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str;
2443 else chars_ = __xtd_convert_to_string<value_type>(str);
2444 return self_;
2445 }
2449 basic_string& operator =(const std::basic_string<xtd::char32>& str) noexcept {
2450 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str;
2451 else chars_ = __xtd_convert_to_string<value_type>(str);
2452 return self_;
2453 }
2457 basic_string& operator =(const std::basic_string<xtd::char8>& str) noexcept {
2458 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str;
2459 else chars_ = __xtd_convert_to_string<value_type>(str);
2460 return self_;
2461 }
2465 basic_string& operator =(const std::basic_string<xtd::wchar>& str) noexcept {
2466 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str;
2467 else chars_ = __xtd_convert_to_string<value_type>(str);
2468 return self_;
2469 }
2470
2474 basic_string& operator =(std::basic_string<char>&& str) noexcept {
2475 if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str);
2476 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2477 return self_;
2478 }
2482 basic_string& operator =(std::basic_string<xtd::char16>&& str) noexcept {
2483 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str);
2484 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2485 return self_;
2486 }
2490 basic_string& operator =(std::basic_string<xtd::char32>&& str) noexcept {
2491 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str);
2492 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2493 return self_;
2494 }
2498 basic_string& operator =(std::basic_string<xtd::char8>&& str) noexcept {
2499 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str);
2500 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2501 return self_;
2502 }
2506 basic_string& operator =(std::basic_string<xtd::wchar>&& str) noexcept {
2507 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str);
2508 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2509 return self_;
2510 }
2511
2516 basic_string& operator =(const char* str) {
2518 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str);
2519 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str));
2520 return self_;
2521 }
2526 basic_string& operator =(const xtd::char16 * str) {
2528 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str);
2529 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str));
2530 return self_;
2531 }
2536 basic_string& operator =(const xtd::char32 * str) {
2538 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str);
2539 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str));
2540 return self_;
2541 }
2546 basic_string& operator =(const xtd::char8 * str) {
2548 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str);
2549 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str));
2550 return self_;
2551 }
2556 basic_string& operator =(const xtd::wchar * str) {
2558 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
2559 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
2560 return self_;
2561 }
2562
2566 basic_string& operator =(char character) {
2567 self_ = basic_string(1, character);
2568 return self_;
2569 }
2573 basic_string& operator =(xtd::char16 character) {
2574 self_ = basic_string(1, character);
2575 return self_;
2576 }
2580 basic_string& operator =(xtd::char32 character) {
2581 self_ = basic_string(1, character);
2582 return self_;
2583 }
2587 basic_string& operator =(xtd::char8 character) {
2588 self_ = basic_string(1, character);
2589 return self_;
2590 }
2594 basic_string& operator =(xtd::wchar character) {
2595 self_ = basic_string(1, character);
2596 return self_;
2597 }
2598
2602 basic_string& operator =(const std::initializer_list<char>& il) {
2603 self_ = basic_string(il);
2604 return self_;
2605 }
2609 basic_string& operator =(const std::initializer_list<xtd::char16>& il) {
2610 self_ = basic_string(il);
2611 return self_;
2612 }
2616 basic_string& operator =(const std::initializer_list<xtd::char32>& il) {
2617 self_ = basic_string(il);
2618 return self_;
2619 }
2623 basic_string& operator =(const std::initializer_list<xtd::char8>& il) {
2624 self_ = basic_string(il);
2625 return self_;
2626 }
2630 basic_string& operator =(const std::initializer_list<xtd::wchar>& il) {
2631 self_ = basic_string(il);
2632 return self_;
2633 }
2634
2638 basic_string & operator +=(const basic_string<char>& str) {
2639 if constexpr(std::is_same_v<char, char_t>) chars_ += str.chars_;
2640 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2641 return self_;
2642 }
2646 basic_string & operator +=(const basic_string<xtd::char16>& str) {
2647 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += str.chars_;
2648 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2649 return self_;
2650 }
2654 basic_string & operator +=(const basic_string<xtd::char32>& str) {
2655 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += str.chars_;
2656 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2657 return self_;
2658 }
2662 basic_string & operator +=(const basic_string<xtd::char8>& str) {
2663 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += str.chars_;
2664 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2665 return self_;
2666 }
2670 basic_string & operator +=(const basic_string<xtd::wchar>& str) {
2671 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += str.chars_;
2672 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2673 return self_;
2674 }
2675
2679 basic_string & operator +=(basic_string<char>&& str) {
2680 if constexpr(std::is_same_v<char, char_t>) chars_ += std::move(str.chars_);
2681 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2682 return self_;
2683 }
2687 basic_string & operator +=(basic_string<xtd::char16>&& str) {
2688 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += std::move(str.chars_);
2689 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2690 return self_;
2691 }
2695 basic_string & operator +=(basic_string<xtd::char32>&& str) {
2696 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += std::move(str.chars_);
2697 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2698 return self_;
2699 }
2703 basic_string & operator +=(basic_string<xtd::char8>&& str) {
2704 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += std::move(str.chars_);
2705 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2706 return self_;
2707 }
2711 basic_string & operator +=(basic_string<xtd::wchar>&& str) {
2712 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += std::move(str.chars_);
2713 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2714 return self_;
2715 }
2716
2720 basic_string & operator +=(const std::basic_string<char>& str) {
2721 if constexpr(std::is_same_v<char, char_t>) chars_ += str;
2722 else chars_ += __xtd_convert_to_string<value_type>(str);
2723 return self_;
2724 }
2728 basic_string & operator +=(const std::basic_string<xtd::char16>& str) {
2729 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += str;
2730 else chars_ += __xtd_convert_to_string<value_type>(str);
2731 return self_;
2732 }
2736 basic_string & operator +=(const std::basic_string<xtd::char32>& str) {
2737 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += str;
2738 else chars_ += __xtd_convert_to_string<value_type>(str);
2739 return self_;
2740 }
2744 basic_string & operator +=(const std::basic_string<xtd::char8>& str) {
2745 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += str;
2746 else chars_ += __xtd_convert_to_string<value_type>(str);
2747 return self_;
2748 }
2752 basic_string & operator +=(const std::basic_string<xtd::wchar>& str) {
2753 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += str;
2754 else chars_ += __xtd_convert_to_string<value_type>(str);
2755 return self_;
2756 }
2757
2761 basic_string & operator +=(const char* str) {
2762 chars_ += basic_string(str).chars_;
2763 return self_;
2764 }
2768 basic_string & operator +=(const xtd::char16 * str) {
2769 chars_.append(basic_string(str).chars_); return self_;
2770 }
2774 basic_string & operator +=(const xtd::char32 * str) {
2775 chars_ += basic_string(str).chars_;
2776 return self_;
2777 }
2781 basic_string & operator +=(const xtd::char8 * str) {
2782 chars_ += basic_string(str).chars_;
2783 return self_;
2784 }
2788 basic_string & operator +=(const xtd::wchar * str) {
2789 chars_ += basic_string(str).chars_;
2790 return self_;
2791 }
2795 basic_string & operator +=(char ch) {
2796 chars_ += basic_string(1, ch).chars_;
2797 return self_;
2798 }
2802 basic_string & operator +=(xtd::char16 ch) {
2803 chars_ += basic_string(1, ch).chars_;
2804 return self_;
2805 }
2809 basic_string & operator +=(xtd::char32 ch) {
2810 chars_ += basic_string(1, ch).chars_;
2811 return self_;
2812 }
2816 basic_string & operator +=(xtd::char8 ch) {
2817 chars_ += basic_string(1, ch).chars_;
2818 return self_;
2819 }
2823 basic_string & operator +=(xtd::wchar ch) {
2824 chars_ += basic_string(1, ch).chars_;
2825 return self_;
2826 }
2827
2832 friend basic_string operator +(const basic_string & lhs, const basic_string<char>& rhs) {
2833 auto result = lhs;
2834 result += rhs;
2835 return result;
2836 }
2841 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char16>& rhs) {
2842 auto result = lhs;
2843 result += rhs;
2844 return result;
2845 }
2850 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char32>& rhs) {
2851 auto result = lhs;
2852 result += rhs;
2853 return result;
2854 }
2859 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char8>& rhs) {
2860 auto result = lhs;
2861 result += rhs;
2862 return result;
2863 }
2868 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::wchar>& rhs) {
2869 auto result = lhs;
2870 result += rhs;
2871 return result;
2872 }
2873
2878 friend basic_string operator +(basic_string&& lhs, basic_string<char>&& rhs) {
2879 auto result = std::move(lhs);
2880 result += std::move(rhs);
2881 return result;
2882 }
2887 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char16>&& rhs) {
2888 auto result = std::move(lhs);
2889 result += std::move(rhs);
2890 return result;
2891 }
2896 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char32>&& rhs) {
2897 auto result = std::move(lhs);
2898 result += std::move(rhs);
2899 return result;
2900 }
2905 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char8>&& rhs) {
2906 auto result = std::move(lhs);
2907 result += std::move(rhs);
2908 return result;
2909 }
2914 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::wchar>&& rhs) {
2915 auto result = std::move(lhs);
2916 result += std::move(rhs);
2917 return result;
2918 }
2919
2924 friend basic_string operator +(basic_string&& lhs, const basic_string<char>& rhs) {
2925 auto result = std::move(lhs);
2926 result += rhs;
2927 return result;
2928 }
2933 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char16>& rhs) {
2934 auto result = std::move(lhs);
2935 result += rhs;
2936 return result;
2937 }
2942 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char32>& rhs) {
2943 auto result = std::move(lhs);
2944 result += rhs;
2945 return result;
2946 }
2951 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char8>& rhs) {
2952 auto result = std::move(lhs);
2953 result += rhs;
2954 return result;
2955 }
2960 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::wchar>& rhs) {
2961 auto result = std::move(lhs);
2962 result += rhs;
2963 return result;
2964 }
2965
2970 friend basic_string operator +(const basic_string & lhs, basic_string<char>&& rhs) {
2971 auto result = lhs;
2972 result += std::move(rhs);
2973 return result;
2974 }
2979 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char16>&& rhs) {
2980 auto result = lhs;
2981 result += std::move(rhs);
2982 return result;
2983 }
2988 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char32>&& rhs) {
2989 auto result = lhs;
2990 result += std::move(rhs);
2991 return result;
2992 }
2997 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char8>&& rhs) {
2998 auto result = lhs;
2999 result += std::move(rhs);
3000 return result;
3001 }
3006 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::wchar>&& rhs) {
3007 auto result = lhs;
3008 result += std::move(rhs);
3009 return result;
3010 }
3011
3016 friend basic_string operator +(const basic_string & lhs, const std::basic_string<char>& rhs) {
3017 auto result = lhs;
3018 result += rhs;
3019 return result;
3020 }
3025 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char16>& rhs) {
3026 auto result = lhs;
3027 result += rhs;
3028 return result;
3029 }
3034 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char32>& rhs) {
3035 auto result = lhs;
3036 result += rhs;
3037 return result;
3038 }
3043 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char8>& rhs) {
3044 auto result = lhs;
3045 result += rhs;
3046 return result;
3047 }
3052 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::wchar>& rhs) {
3053 auto result = lhs;
3054 result += rhs;
3055 return result;
3056 }
3057
3062 friend basic_string operator +(const std::basic_string<char>& lhs, const basic_string & rhs) {
3063 auto result = lhs;
3064 if constexpr(std::is_same_v<char, char_t>) result += rhs.chars();
3065 else result += __xtd_convert_to_string<char>(rhs.chars());
3066 return result;
3067 }
3072 friend basic_string operator +(const std::basic_string<xtd::char16>& lhs, const basic_string & rhs) {
3073 auto result = lhs;
3074 if constexpr(std::is_same_v<xtd::char16, char_t>) result += rhs.chars();
3075 else result += __xtd_convert_to_string<xtd::char16>(rhs.chars());
3076 return result;
3077 }
3082 friend basic_string operator +(const std::basic_string<xtd::char32>& lhs, const basic_string & rhs) {
3083 auto result = lhs;
3084 if constexpr(std::is_same_v<xtd::char32, char_t>) result += rhs.chars();
3085 else result += __xtd_convert_to_string<xtd::char32>(rhs.chars());
3086 return result;
3087 }
3092 friend basic_string operator +(const std::basic_string<xtd::char8>& lhs, const basic_string & rhs) {
3093 auto result = lhs;
3094 if constexpr(std::is_same_v<xtd::char8, char_t>) result += rhs.chars();
3095 else result += __xtd_convert_to_string<xtd::char8>(rhs.chars());
3096 return result;
3097 }
3102 friend basic_string operator +(const std::basic_string<xtd::wchar>& lhs, const basic_string & rhs) {
3103 auto result = lhs;
3104 if constexpr(std::is_same_v<xtd::wchar, char_t>) result += rhs.chars();
3105 else result += __xtd_convert_to_string<xtd::wchar>(rhs.chars());
3106 return result;
3107 }
3108
3113 friend basic_string operator +(const basic_string & lhs, const char* rhs) {
3114 auto result = lhs;
3115 result += rhs;
3116 return result;
3117 }
3122 friend basic_string operator +(const basic_string & lhs, const xtd::char16 * rhs) {
3123 auto result = lhs;
3124 result += rhs;
3125 return result;
3126 }
3131 friend basic_string operator +(const basic_string & lhs, const xtd::char32 * rhs) {
3132 auto result = lhs;
3133 result += rhs;
3134 return result;
3135 }
3140 friend basic_string operator +(const basic_string & lhs, const xtd::char8 * rhs) {
3141 auto result = lhs;
3142 result += rhs;
3143 return result;
3144 }
3149 friend basic_string operator +(const basic_string & lhs, const xtd::wchar * rhs) {
3150 auto result = lhs;
3151 result += rhs;
3152 return result;
3153 }
3154
3159 friend basic_string operator +(basic_string&& lhs, const char* rhs) {
3160 auto result = std::move(lhs);
3161 result += rhs;
3162 return result;
3163 }
3168 friend basic_string operator +(basic_string&& lhs, const xtd::char16 * rhs) {
3169 auto result = std::move(lhs);
3170 result += rhs;
3171 return result;
3172 }
3177 friend basic_string operator +(basic_string&& lhs, const xtd::char32 * rhs) {
3178 auto result = std::move(lhs);
3179 result += rhs;
3180 return result;
3181 }
3186 friend basic_string operator +(basic_string&& lhs, const xtd::char8 * rhs) {
3187 auto result = std::move(lhs);
3188 result += rhs;
3189 return result;
3190 }
3195 friend basic_string operator +(basic_string&& lhs, const xtd::wchar * rhs) {
3196 auto result = std::move(lhs);
3197 result += rhs;
3198 return result;
3199 }
3200
3205 friend basic_string operator +(const char* lhs, const basic_string & rhs) {
3206 auto result = basic_string(lhs);
3207 result += rhs;
3208 return result;
3209 }
3214 friend basic_string operator +(const xtd::char16 * lhs, const basic_string & rhs) {
3215 auto result = basic_string(lhs);
3216 result += rhs;
3217 return result;
3218 }
3223 friend basic_string operator +(const xtd::char32 * lhs, const basic_string & rhs) {
3224 auto result = basic_string(lhs);
3225 result += rhs;
3226 return result;
3227 }
3232 friend basic_string operator +(const xtd::char8 * lhs, const basic_string & rhs) {
3233 auto result = basic_string(lhs);
3234 result += rhs;
3235 return result;
3236 }
3241 friend basic_string operator +(const xtd::wchar * lhs, const basic_string & rhs) {
3242 auto result = basic_string(lhs);
3243 result += rhs;
3244 return result;
3245 }
3246
3251 friend basic_string operator +(const char* lhs, basic_string&& rhs) {
3252 auto result = basic_string(lhs);
3253 result += std::move(rhs);
3254 return result;
3255 }
3260 friend basic_string operator +(const xtd::char16 * lhs, basic_string&& rhs) {
3261 auto result = basic_string(lhs);
3262 result += std::move(rhs);
3263 return result;
3264 }
3269 friend basic_string operator +(const xtd::char32 * lhs, basic_string&& rhs) {
3270 auto result = basic_string(lhs);
3271 result += std::move(rhs);
3272 return result;
3273 }
3278 friend basic_string operator +(const xtd::char8 * lhs, basic_string&& rhs) {
3279 auto result = basic_string(lhs);
3280 result += std::move(rhs);
3281 return result;
3282 }
3287 friend basic_string operator +(const xtd::wchar * lhs, basic_string&& rhs) {
3288 auto result = basic_string(lhs);
3289 result += std::move(rhs);
3290 return result;
3291 }
3292
3297 friend basic_string operator +(const basic_string & lhs, const char rhs) {
3298 auto result = lhs;
3299 result += rhs;
3300 return result;
3301 }
3306 friend basic_string operator +(const basic_string & lhs, const xtd::char16 rhs) {
3307 auto result = lhs;
3308 result += rhs;
3309 return result;
3310 }
3315 friend basic_string operator +(const basic_string & lhs, const xtd::char32 rhs) {
3316 auto result = lhs;
3317 result += rhs;
3318 return result;
3319 }
3324 friend basic_string operator +(const basic_string & lhs, const xtd::char8 rhs) {
3325 auto result = lhs;
3326 result += rhs;
3327 return result;
3328 }
3333 friend basic_string operator +(const basic_string & lhs, const xtd::wchar rhs) {
3334 auto result = lhs;
3335 result += rhs;
3336 return result;
3337 }
3338
3343 friend basic_string operator +(basic_string&& lhs, const char rhs) {
3344 auto result = std::move(lhs);
3345 result += rhs;
3346 return result;
3347 }
3352 friend basic_string operator +(basic_string&& lhs, const xtd::char16 rhs) {
3353 auto result = std::move(lhs);
3354 result += rhs;
3355 return result;
3356 }
3361 friend basic_string operator +(basic_string&& lhs, const xtd::char32 rhs) {
3362 auto result = std::move(lhs);
3363 result += rhs;
3364 return result;
3365 }
3370 friend basic_string operator +(basic_string&& lhs, const xtd::char8 rhs) {
3371 auto result = std::move(lhs);
3372 result += rhs;
3373 return result;
3374 }
3379 friend basic_string operator +(basic_string&& lhs, const xtd::wchar rhs) {
3380 auto result = std::move(lhs);
3381 result += rhs;
3382 return result;
3383 }
3384
3389 friend basic_string operator +(char lhs, const basic_string & rhs) {
3390 auto result = basic_string(1, lhs);
3391 result += rhs;
3392 return result;
3393 }
3398 friend basic_string operator +(xtd::char16 lhs, const basic_string & rhs) {
3399 auto result = basic_string(1, lhs);
3400 result += rhs;
3401 return result;
3402 }
3407 friend basic_string operator +(xtd::char32 lhs, const basic_string & rhs) {
3408 auto result = basic_string(1, lhs);
3409 result += rhs;
3410 return result;
3411 }
3416 friend basic_string operator +(xtd::char8 lhs, const basic_string & rhs) {
3417 auto result = basic_string(1, lhs);
3418 result += rhs;
3419 return result;
3420 }
3425 friend basic_string operator +(xtd::wchar lhs, const basic_string & rhs) {
3426 auto result = basic_string(1, lhs);
3427 result += rhs;
3428 return result;
3429 }
3430
3435 friend basic_string operator +(char lhs, basic_string&& rhs) {
3436 auto result = basic_string(1, lhs);
3437 result += std::move(rhs);
3438 return result;
3439 }
3444 friend basic_string operator +(xtd::char16 lhs, basic_string&& rhs) {
3445 auto result = basic_string(1, lhs);
3446 result += std::move(rhs);
3447 return result;
3448 }
3453 friend basic_string operator +(xtd::char32 lhs, basic_string&& rhs) {
3454 auto result = basic_string(1, lhs);
3455 result += std::move(rhs);
3456 return result;
3457 }
3462 friend basic_string operator +(xtd::char8 lhs, basic_string&& rhs) {
3463 auto result = basic_string(1, lhs);
3464 result += std::move(rhs);
3465 return result;
3466 }
3471 friend basic_string operator +(xtd::wchar lhs, basic_string&& rhs) {
3472 auto result = basic_string(1, lhs);
3473 result += std::move(rhs);
3474 return result;
3475 }
3476
3485 //friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string& str) {return stream << str.to_string().chars_;}
3486 friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string & str) {
3487 if constexpr(std::is_same_v<char, char_t>) return stream << str.chars();
3488 else return stream << __xtd_convert_to_string<char>(str.chars());
3489 }
3496 friend std::basic_ostream<xtd::wchar>& operator <<(std::basic_ostream<xtd::wchar>& stream, const basic_string & str) {return stream << str.to_wstring().chars();}
3497
3506 friend std::basic_istream<char>& operator >>(std::basic_istream<char>& stream, basic_string & str) {
3507 auto s = std::basic_string<char> {};
3508 stream >> s;
3509 str = s;
3510 return stream;
3511 }
3520 friend std::basic_istream<xtd::wchar>& operator >>(std::basic_istream<xtd::wchar>& stream, basic_string & str) {
3521 auto s = std::basic_string<xtd::wchar> {};
3522 stream >> s;
3523 str = s;
3524 return stream;
3525 }
3527
3529
3533 [[deprecated("Replaced by xtd::basic_string::is_empty(const xtd::basic_string&) - Will be removed in version 0.4.0.")]]
3534 bool is_empty() const noexcept {return is_empty(self_);}
3540
3542
3543 template<class object_t>
3544 [[deprecated("Replaced by typeof_<object_t>().name() - Will be removed in version 0.4.0.")]]
3545 static basic_string class_name() {return get_class_name(full_class_name<object_t>());}
3550 template<class object_t>
3551 [[deprecated("Replaced by typeof_(object).name() - Will be removed in version 0.4.0.")]]
3552 static basic_string class_name(const object_t& object) {return get_class_name(full_class_name(object));}
3557 [[deprecated("Replaced by typeof_(info).name() - Will be removed in version 0.4.0.")]]
3558 static basic_string class_name(const std::type_info & info) {return __xtd_get_class_name(info);}
3563 template<class object_t>
3564 [[deprecated("Replaced by typeof_<object_t>().full_name() - Will be removed in version 0.4.0.")]]
3565 static basic_string full_class_name() {return demangle(typeid(object_t).name());}
3570 template<class object_t>
3571 [[deprecated("Replaced by typeof_(object).full_name() - Will be removed in version 0.4.0.")]]
3572 static basic_string full_class_name(const object_t& object) {return demangle(typeid(object).name());}
3577 [[deprecated("Replaced by typeof_(info).full_name() - Will be removed in version 0.4.0.")]]
3578 static basic_string full_class_name(const std::type_info & info) {return __xtd_get_full_class_name(info);}
3580
3581 private:
3582 friend class basic_string<char>;
3583 friend class basic_string<xtd::char16>;
3584 friend class basic_string<xtd::char32>;
3585 friend class basic_string<xtd::char8>;
3586 friend class basic_string<xtd::wchar>;
3587
3588 static const xtd::array<value_type> default_split_separators;
3589 static const xtd::array<value_type> default_trim_chars;
3590
3591 template<class arg_t>
3592 inline static auto convert_param(arg_t&& arg) noexcept {
3593 if constexpr(std::is_same<std::remove_cv_t<std::remove_reference_t<arg_t>>, std::string>::value) return std::forward<arg_t>(arg).c_str();
3594 else if constexpr(std::is_same<std::remove_cv_t<std::remove_reference_t<arg_t>>, std::u16string>::value) return std::forward<arg_t>(arg).c_str();
3595 else if constexpr(std::is_same<std::remove_cv_t<std::remove_reference_t<arg_t>>, std::u32string>::value) return std::forward<arg_t>(arg).c_str();
3596 else if constexpr(std::is_same<std::remove_cv_t<std::remove_reference_t<arg_t>>, std::u8string>::value) return std::forward<arg_t>(arg).c_str();
3597 else if constexpr(std::is_same<std::remove_cv_t<std::remove_reference_t<arg_t>>, std::wstring>::value) return std::forward<arg_t>(arg).c_str();
3598 else if constexpr(std::is_same<std::remove_cv_t<std::remove_reference_t<arg_t>>, basic_string>::value) return std::forward<arg_t>(arg).c_str();
3599 else return std::forward<arg_t>(arg);
3600 }
3601
3602 static basic_string get_class_name(const basic_string & full_name) {
3603 auto length = full_name.last_index_of("<");
3604 if (length == npos) length = full_name.length();
3605 if (full_name.last_index_of("::", 0, length) == npos) return full_name;
3606 return full_name.substring(full_name.last_index_of("::", 0, length) + 2);
3607 }
3608
3609 base_type chars_;
3610 };
3611}
3612
3613#define __XTD_BASIC_STRING_INTERNAL__
3614#include "basic_string_.hpp"
3615#undef __XTD_BASIC_STRING_INTERNAL__
Contains xtd::array definitions.
Contains __format_information struct.
Contains __format method.
Contains string definitions.
Contains __xtd_std_version definitions.
Contains xtd::basic_string class.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:63
Represents text as a sequence of character units.
Definition basic_string.hpp:67
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:1398
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:1522
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:1121
static basic_string class_name(const object_t &object)
Gets the class name of the specified object.
Definition basic_string.hpp:3552
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:1319
allocator_type get_allocator() const
Returns the allocator associated with the string.
Definition basic_string.hpp:1347
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:1410
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:1403
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:1173
xtd::size index_of_any(const xtd::array< value_type > &values, xtd::size start_index) const
Reports the index of the first occurrence in this instance of any character in a specified array of c...
size_type find_last_of(char_t ch, size_type pos) const
Finds the last character equal to one of characters in the given character sequence....
Definition basic_string.hpp:1299
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:1104
enumerator_type get_enumerator() const noexcept override
Returns an enumerator that iterates through a collection.
Definition basic_string.hpp:1357
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:1343
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:1633
virtual const base_type & get_base_type() const noexcept
Returns the underlying base type.
Definition basic_string.hpp:1351
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:1244
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:1461
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:1281
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:3578
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:1288
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:1217
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:1075
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:1179
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:1445
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:1200
int32 compare(size_type pos1, size_type count1, const_pointer s, size_type count2) const
Compares two character sequences.
Definition basic_string.hpp:1043
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:1468
xtd::size index_of_any(const xtd::array< value_type > &values) const noexcept
Reports the index of the first occurrence in this instance of any character in a specified array of c...
size_type find_first_not_of(char_t ch) const
Finds the first character equal to none of the characters in the given character sequence....
Definition basic_string.hpp:1249
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:1066
basic_string quoted() const
Allows insertion and extraction of quoted strings, such as the ones found in CSV or XML.
Definition basic_string.hpp:1549
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:1149
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:1570
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:1337
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:1575
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:1476
static basic_string class_name()
Gets the class name of the object_t.
Definition basic_string.hpp:3545
static basic_string class_name(const std::type_info &info)
Gets the class name of the specified object.
Definition basic_string.hpp:3558
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:1325
bool is_empty() const noexcept
Indicates whether this basic_string is an empty basic_string (""). /.
Definition basic_string.hpp:3534
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:1161
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:1554
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:1054
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:1543
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:1592
xtd::size get_hash_code() const noexcept override
Returns the hash code for this basic_string.
Definition basic_string.hpp:1355
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:1071
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:1305
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:1223
bool ends_with(value_type value) const noexcept
Determines whether the end of this basic_string matches the specified character.
Definition basic_string.hpp:1099
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:1490
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:1187
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:1390
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:1129
xtd::size last_index_of_any(const xtd::array< value_type > &values) const noexcept
Reports the index of the last occurrence in this instance of any character in a specified array of ch...
xtd::size index_of(const basic_string &value) const noexcept
Reports the index of the first occurrence of the specified basic_string in this basic_string.
Definition basic_string.hpp:1378
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:1255
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:1080
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:1205
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:1237
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:1231
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:1586
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:1116
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:1091
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:1536
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:1267
static basic_string full_class_name()
Definition basic_string.hpp:3565
xtd::size last_index_of_any(const xtd::array< value_type > &values, xtd::size start_index, xtd::size count) const
Reports the index of the last occurrence in this instance of any character in a specified array of ch...
bool ends_with(const basic_string &value) const noexcept
Determines whether the end of this basic_string matches the specified basic_string.
Definition basic_string.hpp:1111
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:1193
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:3572
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:1455
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:1529
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:1085
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:1293
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:1332
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:1167
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:1261
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:1275
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:1311
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:1135
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:1383
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:1211
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:1560
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:1482
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:1143
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:1156
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:1640
auto append(const source_t &element) const noexcept
Appends a value to the end of the sequence.
Definition enumerable.hpp:144
auto concat(const ienumerable< char_t > &second) const noexcept
Definition enumerable.hpp:185
Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Definition ienumerable.hpp:40
char_t value_type
Definition ienumerable.hpp:46
typename xtd::collections::generic::extensions::enumerable_iterators< char_t, xtd::collections::generic::ienumerable< char_t > >::const_iterator const_iterator
Definition ienumerable.hpp:50
typename xtd::collections::generic::extensions::enumerable_iterators< char_t, xtd::collections::generic::ienumerable< char_t > >::iterator iterator
Definition ienumerable.hpp:48
Supports a simple iteration over a generic collection.
Definition ienumerator.hpp:58
static xtd::size combine(args_t... values) noexcept
Combines values into a hash code.
Definition hash_code.hpp:70
static void throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current())
Throws an exption with specified exception case.
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.hpp:21
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
object()=default
Create a new instance of the ultimate base class object.
virtual xtd::string to_string() const noexcept
Returns a xtd::string that represents the current object.
Contains xtd::collections::generic::ienumerable <type_t> interface.
xtd::string format(const xtd::string &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
Definition format.hpp:21
xtd::string sprintf(const xtd::string &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to basic_string using the specified f...
Definition sprintf.hpp:73
@ argument
The argument is not valid.
Definition exception_case.hpp:31
@ index_out_of_range
The index is out of range.
Definition exception_case.hpp:61
@ argument_out_of_range
The argument is out of range.
Definition exception_case.hpp:35
@ null_pointer
The pointer is null.
Definition exception_case.hpp:79
#define self_
The self_ expression is a reference value expression whose value is the reference of the implicit obj...
Definition self.hpp:20
constexpr xtd::size npos
Represents a value that is not a valid position in a collection.
Definition npos.hpp:26
constexpr xtd::size epos
Represents the index of the last valid element in a collection.
Definition epos.hpp:33
constexpr xtd::size bpos
Represents the index of the firsy valid element in a collection.
Definition bpos.hpp:25
xtd::string name() noexcept
Gets the thread name of the current thread.
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
char8_t char8
Represents a 8-bit unicode character.
Definition char8.hpp:26
null_ptr null
Represents a null pointer value.
wchar_t wchar
Represents a wide character.
Definition wchar.hpp:24
char16_t char16
Represents a 16-bit unicode character.
Definition char16.hpp:26
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
char32_t char32
Represents a 32-bit unicode character.
Definition char32.hpp:23
string_comparison
Specifies the culture, case, and sort rules to be used by certain overloads of the xtd::string::compa...
Definition string_comparison.hpp:14
string_split_options
Specifies whether applicable xtd::string::split method overloads include or omit empty substrings fro...
Definition string_split_options.hpp:14
ptr< type_t > new_ptr(args_t &&... args)
The xtd::new_ptr operator creates a xtd::ptr object.
Definition new_ptr.hpp:24
value_t parse(const std::string &str)
Convert a string into a type.
Definition parse.hpp:34
bool try_parse(const std::basic_string< char > &str, value_t &value) noexcept
Convert a string into a type.
Definition parse.hpp:416
@ ordinal
Compare strings using ordinal (binary) sort rules.
Definition string_comparison.hpp:24
@ ordinal_ignore_case
Compare strings using ordinal (binary) sort rules and ignoring the case of the strings being compared...
Definition string_comparison.hpp:26
@ s
The S key.
Definition console_key.hpp:124
@ a
The A key.
Definition console_key.hpp:88
@ c
The C key.
Definition console_key.hpp:92
@ i
The I key.
Definition console_key.hpp:104
@ b
The B key.
Definition console_key.hpp:90
@ separator
The Separator key.
Definition console_key.hpp:172
@ escape
The ESC (ESCAPE) key.
Definition console_key.hpp:34
@ stream
Supports reliable, two-way, connection-based byte streams without the duplication of data and without...
Definition socket_type.hpp:36
size_type
Specifies how rows or columns of user interface (UI) elements should be sized relative to their conta...
Definition size_type.hpp:22
Contains xtd::hash_code class.
Contains xtd::icomparable interface.
Contains xtd::iequatable interface.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
read_only_span< type_t, count > first() const
Obtains a subspan consisting of the first count elements of the sequence.
Definition read_only_span.hpp:282
read_only_span< type_t, count > last() const
Obtains a subspan consisting of the last N elements of the sequence.
Definition read_only_span.hpp:307
const_reference operator[](size_type index) const
Gets the element at the specified zero-based index.
Definition read_only_span.hpp:400
constexpr size_type length() const noexcept
Returns the length of the current read_only_span.
Definition read_only_span.hpp:229
constexpr const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
xtd::array< std::remove_cv_t< type_t > > to_array() const noexcept
Copies the contents of this read_only_span into a new array.
Definition read_only_span.hpp:368
Contains xtd::null pointer valiue.
Contains xtd::object class.
Contains xtd::parse methods.
Contains xtd::string_comparison enum class.
Contains xtd::string_split_options enum class.
Supports a simple iteration over a generic collection.
Definition enumerator.hpp:38
Contains xtd fundamental types.
Contains unused_ keyword.