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 struct basic_string_enumerator : public xtd::collections::generic::ienumerator<value_type> {
1359 explicit basic_string_enumerator(const basic_string & chars) : chars_(chars) {}
1360 const value_type& current() const override {
1362 return chars_[index_];
1363 }
1364 bool move_next() override {return ++index_ < chars_.length();}
1365 void reset() override {index_ = basic_string::npos;}
1366
1367 private:
1368 const basic_string& chars_;
1369 size_type index_ = basic_string::npos;
1370 };
1372 }
1373
1377 xtd::size index_of(const basic_string & value) const noexcept {return index_of(value, 0, length());}
1382 xtd::size index_of(const basic_string & value, xtd::size start_index) const {return index_of(value, start_index, length() - start_index);}
1389 xtd::size index_of(const basic_string & value, xtd::size start_index, xtd::size count) const {
1391 auto result = find(value, start_index);
1392 return result > start_index + count ? npos : result;
1393 }
1394
1397 xtd::size index_of(value_type value) const noexcept {return index_of(value, 0, length());}
1402 xtd::size index_of(value_type value, xtd::size start_index) const {return index_of(value, start_index, length() - start_index);}
1411 auto result = find(value, start_index);
1412 return result > start_index + count ? npos : result;
1413 }
1414
1418 xtd::size index_of_any(const xtd::array<value_type>& values) const noexcept;
1424 xtd::size index_of_any(const xtd::array<value_type>& values, xtd::size start_index) const;
1433 xtd::size index_of_any(const std::initializer_list<value_type>& values) const noexcept;
1434 xtd::size index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index) const;
1435 xtd::size index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index, xtd::size count) const;
1437
1444 basic_string insert(xtd::size start_index, const basic_string & value) const {
1446 auto result = self_;
1447 result.chars_.insert(start_index, value);
1448 return result;
1449 }
1450
1454 xtd::size last_index_of(const basic_string & value) const noexcept {return last_index_of(value, 0, length());}
1460 xtd::size last_index_of(const basic_string & value, xtd::size start_index) const {return last_index_of(value, start_index, length() - start_index);}
1467 xtd::size last_index_of(const basic_string & value, xtd::size start_index, xtd::size count) const {
1469 auto result = chars_.rfind(value, start_index + count - value.length());
1470 return result < start_index ? npos : result;
1471 }
1472
1475 xtd::size last_index_of(value_type value) const noexcept {return last_index_of(value, 0, length());}
1481 xtd::size last_index_of(value_type value, xtd::size start_index) const {return last_index_of(value, start_index, length() - start_index);}
1491 auto result = chars_.rfind(value, start_index + count - 1);
1492 return result < start_index ? npos : result;
1493 }
1494
1511 xtd::size last_index_of_any(const std::initializer_list<value_type>& values) const noexcept;
1512 xtd::size last_index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index) const;
1513 xtd::size last_index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index, xtd::size count) const;
1515
1521 basic_string pad_left(xtd::size total_width) const noexcept {return pad_left(total_width, ' ');}
1528 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_;}
1529
1535 basic_string pad_right(xtd::size total_width) const noexcept {return pad_right(total_width, ' ');}
1542 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);}
1543
1548 basic_string quoted() const {return quoted('"', '\\');}
1553 basic_string quoted(value_type delimiter) const {return quoted(delimiter, '\\');}
1560 std::wstringstream ss;
1561 if constexpr(std::is_same_v<xtd::wchar, value_type>) ss << std::quoted(chars_, delimiter, escape);
1562 else ss << std::quoted(__xtd_convert_to_string<xtd::wchar>(chars_), static_cast<xtd::wchar>(delimiter), static_cast<xtd::wchar>(escape));
1563 return ss.str();
1564 }
1565
1569 basic_string remove(xtd::size start_index) const {return remove(start_index, length() - start_index);}
1576 auto result = self_;
1577 result.chars_.erase(start_index, count);
1578 return result;
1579 }
1580
1585 basic_string replace(value_type old_char, value_type new_char) const noexcept {return replace(string(1, old_char), string(1, new_char));}
1591 basic_string replace(const basic_string & old_string, const basic_string & new_string) const noexcept {
1592 auto result = self_;
1593 auto old_size = old_string.length();
1594 auto new_size = new_string.length();
1595 auto index = xtd::size {0};
1596 while (true) {
1597 index = result.find(old_string, index);
1598 if (index == npos) break;
1599 if (old_size == new_size) result.chars_.replace(index, old_size, new_string);
1600 else {
1601 result.chars_.erase(index, old_string.length());
1602 result.chars_.insert(index, new_string);
1603 }
1604 index += new_string.length();
1605 }
1606 return result;
1607 }
1608
1612 size_type rfind(const basic_string & str) const {return chars_.rfind(str);}
1618 size_type rfind(const basic_string & str, size_type pos) const {return chars_.rfind(str, pos);}
1626 size_type rfind(const_pointer s, size_type pos, size_type count) const {return chars_.rfind(s, pos, count);}
1632 size_type rfind(const_pointer s) const {return chars_.rfind(s);}
1639 size_type rfind(const_pointer s, size_type pos) const {return chars_.rfind(s, pos);}
1644 size_type rfind(value_type ch) const {return chars_.rfind(ch);}
1650 size_type rfind(value_type ch, size_type pos) const {return chars_.rfind(ch, pos);}
1651
1656 xtd::array<basic_string> split() const noexcept;
1662 xtd::array<basic_string> split(value_type separator) const noexcept;
1679 xtd::array<basic_string> split(value_type separator, xtd::string_split_options options) const noexcept;
1688 xtd::array<basic_string> split(value_type separator, xtd::size count) const noexcept;
1700 xtd::array<basic_string> split(value_type separator, xtd::size count, xtd::string_split_options options) const noexcept;
1706 xtd::array<basic_string> split(const xtd::array<value_type>& separators) const noexcept;
1723 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::string_split_options options) const noexcept;
1732 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::size count) const noexcept;
1744 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::size count, xtd::string_split_options options) const noexcept;
1745
1750 bool starts_with(value_type value) const noexcept {return starts_with(value, false);}
1756 bool starts_with(value_type value, bool ignore_case) const noexcept {
1757 if (ignore_case) return to_lower().find(static_cast<value_type>(tolower(value))) == 0;
1758 return find(value) == 0;
1759 }
1764 bool starts_with(const basic_string & value) const noexcept {return starts_with(value, string_comparison::ordinal);}
1770 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);}
1775 bool starts_with(const basic_string & value, xtd::string_comparison comparison_type) const noexcept {
1776 if (comparison_type == xtd::string_comparison::ordinal_ignore_case) return to_lower().find(value.to_lower()) == 0;
1777 return find(value) == 0;
1778 }
1779
1784 basic_string substr() const {return chars_.substr();}
1790 basic_string substr(size_type pos) const {
1792 return chars_.substr(pos);
1793 }
1800 basic_string substr(size_type pos, size_type count) const {
1802 return chars_.substr(pos, count);
1803 }
1804
1810 basic_string substring(xtd::size start_index) const {
1812 return substr(start_index);
1813 }
1819 basic_string substring(xtd::size start_index, xtd::size length) const {
1820 if (start_index > self_.length() || start_index + length > self_.length()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range);
1821 return substr(start_index, length);
1822 }
1823
1826 xtd::array<value_type> to_array() const noexcept;
1830 xtd::array<value_type> to_array(xtd::size start_index) const;
1835 xtd::array<value_type> to_array(xtd::size start_index, xtd::size length) const;
1836
1839 xtd::array<value_type> to_char_array() const noexcept;
1844 xtd::array<value_type> to_char_array(xtd::size start_index, xtd::size length) const;
1845
1848 basic_string to_lower() const noexcept {
1849 auto result = basic_string::empty_string;
1850 std::for_each(chars_.begin(), chars_.end(), [&](auto c) {result += static_cast<value_type>(std::tolower(c));});
1851 return result;
1852 }
1853
1857 basic_string<char> to_string() const noexcept override {
1858 if constexpr(std::is_same_v<char, char_t>) return chars_;
1859 else return __xtd_convert_to_string<char>(chars_);
1860 }
1861
1864 basic_string to_title_case() const noexcept;
1865
1868 basic_string<xtd::char16> to_u16string() const noexcept {
1869 if constexpr(std::is_same_v<xtd::char16, char_t>) return chars_;
1870 else return __xtd_convert_to_string<xtd::char16>(chars_);
1871 }
1872
1875 basic_string<xtd::char32> to_u32string() const noexcept {
1876 if constexpr(std::is_same_v<xtd::char32, char_t>) return chars_;
1877 else return __xtd_convert_to_string<xtd::char32>(chars_);
1878 }
1879
1882 basic_string<xtd::char8> to_u8string() const noexcept {
1883 if constexpr(std::is_same_v<xtd::char8, char_t>) return chars_;
1884 else return __xtd_convert_to_string<xtd::char8>(chars_);
1885 }
1886
1889 basic_string to_upper() const noexcept {
1890 auto result = basic_string::empty_string;
1891 std::for_each(chars_.begin(), chars_.end(), [&](auto c) {result += static_cast<value_type>(std::toupper(c));});
1892 return result;
1893 }
1894
1897 basic_string<xtd::wchar> to_wstring() const noexcept {
1898 if constexpr(std::is_same_v<xtd::wchar, char_t>) return chars_;
1899 else return __xtd_convert_to_string<xtd::wchar>(chars_);
1900 }
1901
1906 basic_string trim() const noexcept {return trim(default_trim_chars);}
1911 basic_string trim(value_type trim_char) const noexcept;
1916 basic_string trim(const xtd::array<value_type>& trim_chars) const noexcept;
1917
1922 basic_string trim_end() const noexcept {return trim_end(default_trim_chars);}
1927 basic_string trim_end(value_type trim_char) const noexcept;
1932 basic_string trim_end(const xtd::array<value_type>& trim_chars) const noexcept;
1933
1938 basic_string trim_start() const noexcept {return trim_start(default_trim_chars);}
1943 basic_string trim_start(value_type trim_char) const noexcept;
1948 basic_string trim_start(const xtd::array<value_type>& trim_chars) const noexcept;
1950
1952
1963 static int32 compare(const basic_string & str_a, const basic_string & str_b) noexcept {return compare(str_a, str_b, false);}
1974 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);}
1985 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);}
1998 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);}
2012 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);}
2026 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));}
2027
2034 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;}
2041 template<class object_a_t, class object_b_t, class object_c_t, class object_d_t>
2042 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);}
2048 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;}
2054 template<class object_a_t, class object_b_t, class object_c_t>
2055 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);}
2060 static basic_string concat(const basic_string & str_a, const basic_string & str_b) noexcept {return str_a + str_b;}
2065 template<class object_a_t, class object_b_t>
2066 inline static basic_string concat(object_a_t obj_a, object_b_t obj_b) noexcept {return format("{}{}", obj_a, obj_b);}
2070 static basic_string concat(const xtd::array<basic_string>& values) noexcept;
2072 static basic_string concat(const xtd::array<const_pointer>& values) noexcept;
2073 template<class other_char_t>
2074 inline static basic_string concat(const xtd::array<const other_char_t*>& values) noexcept;
2075 static basic_string concat(const std::initializer_list<basic_string>& values) noexcept {
2076 auto result = basic_string::empty_string;
2077 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2078 return result;
2079 }
2080 static basic_string concat(const std::initializer_list<const_pointer>& values) noexcept {
2081 auto result = basic_string::empty_string;
2082 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2083 return result;
2084 }
2085 template<class other_char_t>
2086 inline static basic_string concat(const std::initializer_list<const other_char_t*>& values) noexcept {
2087 auto result = basic_string::empty_string;
2088 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2089 return result;
2090 }
2095 template<class object_t>
2096 inline static basic_string concat(const xtd::array<object_t>& args) noexcept;
2098 template<class object_t>
2099 inline static basic_string concat(const std::initializer_list<object_t>& args) noexcept {
2100 basic_string result;
2101 for (const auto& arg : args)
2102 result += format("{}", arg);
2103 return result;
2104 }
2109 template<class value_t>
2110 inline static basic_string concat(value_t value) noexcept {
2111 return format("{}", value);
2112 }
2113
2134 static basic_string demangle(const basic_string & name) {
2135 if constexpr(std::is_same_v<char, char_t>) return __xtd_demangle(name.chars());
2136 else return __xtd_demangle(__xtd_convert_to_string<char>(name.chars()));
2137 }
2138
2144 static bool equals(const basic_string & a, const basic_string & b) noexcept {return a.equals(b);}
2150 template<class char_a_t, class char_b_t>
2151 inline static bool equals(const char_a_t* a, const char_b_t* b) noexcept {return basic_string {a}.equals(basic_string {b});}
2152
2159 static bool equals(const basic_string & a, const basic_string & b, bool ignore_case) noexcept {return a.equals(b, ignore_case);}
2166 template<class char_a_t, class char_b_t>
2167 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);}
2168
2175 template<class ...args_t>
2176 inline static basic_string format(const basic_string<char>& fmt, args_t&& ... args);
2177
2185 template<class ...args_t>
2186 inline static basic_string format(const std::locale & loc, const basic_string<char>& fmt, args_t&& ... args);
2187
2191 static bool is_empty(const xtd::basic_string<value_type, traits_type, allocator_type>& string) noexcept {return !string.length();}
2192
2199 template<class collection_t>
2200 inline static basic_string join(const basic_string & separator, const collection_t& values) noexcept {
2201 xtd::size i = 0;
2202 basic_string result;
2203 for (const auto& item : values)
2204 result += format("{}{}", (i++ != 0 ? separator : basic_string {}), item);
2205 return result;
2206 }
2214 template<class collection_t>
2215 inline static basic_string join(const basic_string & separator, const collection_t& values, xtd::size index) {return join(separator, values, index, values.size() - index);}
2224 template<class collection_t>
2225 inline static basic_string join(const basic_string & separator, const collection_t& values, xtd::size index, xtd::size count) {
2226 if (index > values.size() || index + count > values.size()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::argument_out_of_range);
2227 xtd::size i = 0;
2228 basic_string result;
2229 for (const auto& item : values) {
2230 if (i >= index) result += format("{}{}", (i != index ? separator : basic_string {}), item);
2231 if (++i >= index + count) break;
2232 }
2233 return result;
2234 }
2235
2237 template<class value_t>
2238 inline static basic_string join(const basic_string & separator, const std::initializer_list<value_t>& values) noexcept;
2239 template<class value_t>
2240 inline static basic_string join(const basic_string & separator, const std::initializer_list<value_t>& values, xtd::size index);
2241 template<class value_t>
2242 inline static basic_string join(const basic_string & separator, const std::initializer_list<value_t>& values, xtd::size index, xtd::size count);
2244
2248 template<class value_t>
2249 inline static value_t parse(const basic_string & str) {
2250 if constexpr(std::is_same_v<char, char_t>) return xtd::parse<value_t>(str.chars());
2251 else return xtd::parse<value_t>(__xtd_convert_to_string<char>(str.chars()));
2252 }
2253
2313 template<class ...args_t>
2314 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)) ...);}
2315
2320 template<class value_t>
2321 inline static bool try_parse(const basic_string & str, value_t& value) noexcept {
2322 try {
2323 value = parse<value_t>(str);
2324 return true;
2325 } catch (...) {
2326 return false;
2327 }
2328 }
2330
2332
2338 const_reference operator [](xtd::size index) const {
2340 return chars_[index == epos ? length() - 1 : index];
2341 }
2342
2345 operator const base_type& () const noexcept {return chars_;}
2346
2350 basic_string& operator =(const basic_string<char>& str) noexcept {
2351 if constexpr(std::is_same<char_t, char>::value) chars_ = str.chars_;
2352 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2353 return self_;
2354 }
2358 basic_string& operator =(const basic_string<xtd::char16>& str) noexcept {
2359 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str.chars_;
2360 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2361 return self_;
2362 }
2366 basic_string& operator =(const basic_string<xtd::char32>& str) noexcept {
2367 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str.chars_;
2368 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2369 return self_;
2370 }
2374 basic_string& operator =(const basic_string<xtd::char8>& str) noexcept {
2375 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str.chars_;
2376 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2377 return self_;
2378 }
2382 basic_string& operator =(const basic_string<xtd::wchar>& str) noexcept {
2383 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str.chars_;
2384 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2385 return self_;
2386 }
2387
2391 basic_string& operator =(basic_string<char>&& str) noexcept {
2392 if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str.chars_);
2393 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2394 return self_;
2395 }
2399 basic_string& operator =(basic_string<xtd::char16>&& str) noexcept {
2400 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str.chars_);
2401 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2402 return self_;
2403 }
2407 basic_string& operator =(basic_string<xtd::char32>&& str) noexcept {
2408 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str.chars_);
2409 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2410 return self_;
2411 }
2415 basic_string& operator =(basic_string<xtd::char8>&& str) noexcept {
2416 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str.chars_);
2417 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2418 return self_;
2419 }
2423 basic_string& operator =(basic_string<xtd::wchar>&& str) noexcept {
2424 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str.chars_);
2425 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2426 return self_;
2427 }
2428
2432 basic_string& operator =(const std::basic_string<char>& str) noexcept {
2433 if constexpr(std::is_same<char_t, char>::value) chars_ = str;
2434 else chars_ = __xtd_convert_to_string<value_type>(str);
2435 return self_;
2436 }
2440 basic_string& operator =(const std::basic_string<xtd::char16>& str) noexcept {
2441 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str;
2442 else chars_ = __xtd_convert_to_string<value_type>(str);
2443 return self_;
2444 }
2448 basic_string& operator =(const std::basic_string<xtd::char32>& str) noexcept {
2449 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str;
2450 else chars_ = __xtd_convert_to_string<value_type>(str);
2451 return self_;
2452 }
2456 basic_string& operator =(const std::basic_string<xtd::char8>& str) noexcept {
2457 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str;
2458 else chars_ = __xtd_convert_to_string<value_type>(str);
2459 return self_;
2460 }
2464 basic_string& operator =(const std::basic_string<xtd::wchar>& str) noexcept {
2465 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str;
2466 else chars_ = __xtd_convert_to_string<value_type>(str);
2467 return self_;
2468 }
2469
2473 basic_string& operator =(std::basic_string<char>&& str) noexcept {
2474 if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str);
2475 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2476 return self_;
2477 }
2481 basic_string& operator =(std::basic_string<xtd::char16>&& str) noexcept {
2482 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str);
2483 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2484 return self_;
2485 }
2489 basic_string& operator =(std::basic_string<xtd::char32>&& str) noexcept {
2490 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str);
2491 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2492 return self_;
2493 }
2497 basic_string& operator =(std::basic_string<xtd::char8>&& str) noexcept {
2498 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str);
2499 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2500 return self_;
2501 }
2505 basic_string& operator =(std::basic_string<xtd::wchar>&& str) noexcept {
2506 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str);
2507 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2508 return self_;
2509 }
2510
2515 basic_string& operator =(const char* str) {
2517 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str);
2518 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str));
2519 return self_;
2520 }
2525 basic_string& operator =(const xtd::char16 * str) {
2527 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str);
2528 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str));
2529 return self_;
2530 }
2535 basic_string& operator =(const xtd::char32 * str) {
2537 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str);
2538 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str));
2539 return self_;
2540 }
2545 basic_string& operator =(const xtd::char8 * str) {
2547 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str);
2548 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str));
2549 return self_;
2550 }
2555 basic_string& operator =(const xtd::wchar * str) {
2557 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
2558 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
2559 return self_;
2560 }
2561
2565 basic_string& operator =(char character) {
2566 self_ = basic_string(1, character);
2567 return self_;
2568 }
2572 basic_string& operator =(xtd::char16 character) {
2573 self_ = basic_string(1, character);
2574 return self_;
2575 }
2579 basic_string& operator =(xtd::char32 character) {
2580 self_ = basic_string(1, character);
2581 return self_;
2582 }
2586 basic_string& operator =(xtd::char8 character) {
2587 self_ = basic_string(1, character);
2588 return self_;
2589 }
2593 basic_string& operator =(xtd::wchar character) {
2594 self_ = basic_string(1, character);
2595 return self_;
2596 }
2597
2601 basic_string& operator =(const std::initializer_list<char>& il) {
2602 self_ = basic_string(il);
2603 return self_;
2604 }
2608 basic_string& operator =(const std::initializer_list<xtd::char16>& il) {
2609 self_ = basic_string(il);
2610 return self_;
2611 }
2615 basic_string& operator =(const std::initializer_list<xtd::char32>& il) {
2616 self_ = basic_string(il);
2617 return self_;
2618 }
2622 basic_string& operator =(const std::initializer_list<xtd::char8>& il) {
2623 self_ = basic_string(il);
2624 return self_;
2625 }
2629 basic_string& operator =(const std::initializer_list<xtd::wchar>& il) {
2630 self_ = basic_string(il);
2631 return self_;
2632 }
2633
2637 basic_string& operator +=(const basic_string<char>& str) {
2638 if constexpr(std::is_same_v<char, char_t>) chars_ += str.chars_;
2639 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2640 return self_;
2641 }
2645 basic_string& operator +=(const basic_string<xtd::char16>& str) {
2646 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += str.chars_;
2647 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2648 return self_;
2649 }
2653 basic_string& operator +=(const basic_string<xtd::char32>& str) {
2654 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += str.chars_;
2655 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2656 return self_;
2657 }
2661 basic_string& operator +=(const basic_string<xtd::char8>& str) {
2662 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += str.chars_;
2663 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2664 return self_;
2665 }
2669 basic_string& operator +=(const basic_string<xtd::wchar>& str) {
2670 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += str.chars_;
2671 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2672 return self_;
2673 }
2674
2678 basic_string& operator +=(basic_string<char>&& str) {
2679 if constexpr(std::is_same_v<char, char_t>) chars_ += std::move(str.chars_);
2680 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2681 return self_;
2682 }
2686 basic_string& operator +=(basic_string<xtd::char16>&& str) {
2687 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += std::move(str.chars_);
2688 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2689 return self_;
2690 }
2694 basic_string& operator +=(basic_string<xtd::char32>&& str) {
2695 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += std::move(str.chars_);
2696 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2697 return self_;
2698 }
2702 basic_string& operator +=(basic_string<xtd::char8>&& str) {
2703 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += std::move(str.chars_);
2704 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2705 return self_;
2706 }
2710 basic_string& operator +=(basic_string<xtd::wchar>&& str) {
2711 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += std::move(str.chars_);
2712 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2713 return self_;
2714 }
2715
2719 basic_string& operator +=(const std::basic_string<char>& str) {
2720 if constexpr(std::is_same_v<char, char_t>) chars_ += str;
2721 else chars_ += __xtd_convert_to_string<value_type>(str);
2722 return self_;
2723 }
2727 basic_string& operator +=(const std::basic_string<xtd::char16>& str) {
2728 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += str;
2729 else chars_ += __xtd_convert_to_string<value_type>(str);
2730 return self_;
2731 }
2735 basic_string& operator +=(const std::basic_string<xtd::char32>& str) {
2736 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += str;
2737 else chars_ += __xtd_convert_to_string<value_type>(str);
2738 return self_;
2739 }
2743 basic_string& operator +=(const std::basic_string<xtd::char8>& str) {
2744 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += str;
2745 else chars_ += __xtd_convert_to_string<value_type>(str);
2746 return self_;
2747 }
2751 basic_string& operator +=(const std::basic_string<xtd::wchar>& str) {
2752 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += str;
2753 else chars_ += __xtd_convert_to_string<value_type>(str);
2754 return self_;
2755 }
2756
2760 basic_string& operator +=(const char* str) {
2761 chars_ += basic_string(str).chars_;
2762 return self_;
2763 }
2767 basic_string& operator +=(const xtd::char16 * str) {
2768 chars_.append(basic_string(str).chars_); return self_;
2769 }
2773 basic_string& operator +=(const xtd::char32 * str) {
2774 chars_ += basic_string(str).chars_;
2775 return self_;
2776 }
2780 basic_string& operator +=(const xtd::char8 * str) {
2781 chars_ += basic_string(str).chars_;
2782 return self_;
2783 }
2787 basic_string& operator +=(const xtd::wchar * str) {
2788 chars_ += basic_string(str).chars_;
2789 return self_;
2790 }
2794 basic_string& operator +=(char ch) {
2795 chars_ += basic_string(1, ch).chars_;
2796 return self_;
2797 }
2801 basic_string& operator +=(xtd::char16 ch) {
2802 chars_ += basic_string(1, ch).chars_;
2803 return self_;
2804 }
2808 basic_string& operator +=(xtd::char32 ch) {
2809 chars_ += basic_string(1, ch).chars_;
2810 return self_;
2811 }
2815 basic_string& operator +=(xtd::char8 ch) {
2816 chars_ += basic_string(1, ch).chars_;
2817 return self_;
2818 }
2822 basic_string& operator +=(xtd::wchar ch) {
2823 chars_ += basic_string(1, ch).chars_;
2824 return self_;
2825 }
2826
2831 friend basic_string operator +(const basic_string & lhs, const basic_string<char>& rhs) {
2832 auto result = lhs;
2833 result += rhs;
2834 return result;
2835 }
2840 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char16>& rhs) {
2841 auto result = lhs;
2842 result += rhs;
2843 return result;
2844 }
2849 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char32>& rhs) {
2850 auto result = lhs;
2851 result += rhs;
2852 return result;
2853 }
2858 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char8>& rhs) {
2859 auto result = lhs;
2860 result += rhs;
2861 return result;
2862 }
2867 friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::wchar>& rhs) {
2868 auto result = lhs;
2869 result += rhs;
2870 return result;
2871 }
2872
2877 friend basic_string operator +(basic_string&& lhs, basic_string<char>&& rhs) {
2878 auto result = std::move(lhs);
2879 result += std::move(rhs);
2880 return result;
2881 }
2886 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char16>&& rhs) {
2887 auto result = std::move(lhs);
2888 result += std::move(rhs);
2889 return result;
2890 }
2895 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char32>&& rhs) {
2896 auto result = std::move(lhs);
2897 result += std::move(rhs);
2898 return result;
2899 }
2904 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char8>&& rhs) {
2905 auto result = std::move(lhs);
2906 result += std::move(rhs);
2907 return result;
2908 }
2913 friend basic_string operator +(basic_string&& lhs, basic_string<xtd::wchar>&& rhs) {
2914 auto result = std::move(lhs);
2915 result += std::move(rhs);
2916 return result;
2917 }
2918
2923 friend basic_string operator +(basic_string&& lhs, const basic_string<char>& rhs) {
2924 auto result = std::move(lhs);
2925 result += rhs;
2926 return result;
2927 }
2932 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char16>& rhs) {
2933 auto result = std::move(lhs);
2934 result += rhs;
2935 return result;
2936 }
2941 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char32>& rhs) {
2942 auto result = std::move(lhs);
2943 result += rhs;
2944 return result;
2945 }
2950 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char8>& rhs) {
2951 auto result = std::move(lhs);
2952 result += rhs;
2953 return result;
2954 }
2959 friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::wchar>& rhs) {
2960 auto result = std::move(lhs);
2961 result += rhs;
2962 return result;
2963 }
2964
2969 friend basic_string operator +(const basic_string & lhs, basic_string<char>&& rhs) {
2970 auto result = lhs;
2971 result += std::move(rhs);
2972 return result;
2973 }
2978 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char16>&& rhs) {
2979 auto result = lhs;
2980 result += std::move(rhs);
2981 return result;
2982 }
2987 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char32>&& rhs) {
2988 auto result = lhs;
2989 result += std::move(rhs);
2990 return result;
2991 }
2996 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char8>&& rhs) {
2997 auto result = lhs;
2998 result += std::move(rhs);
2999 return result;
3000 }
3005 friend basic_string operator +(const basic_string & lhs, basic_string<xtd::wchar>&& rhs) {
3006 auto result = lhs;
3007 result += std::move(rhs);
3008 return result;
3009 }
3010
3015 friend basic_string operator +(const basic_string & lhs, const std::basic_string<char>& rhs) {
3016 auto result = lhs;
3017 result += rhs;
3018 return result;
3019 }
3024 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char16>& rhs) {
3025 auto result = lhs;
3026 result += rhs;
3027 return result;
3028 }
3033 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char32>& rhs) {
3034 auto result = lhs;
3035 result += rhs;
3036 return result;
3037 }
3042 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char8>& rhs) {
3043 auto result = lhs;
3044 result += rhs;
3045 return result;
3046 }
3051 friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::wchar>& rhs) {
3052 auto result = lhs;
3053 result += rhs;
3054 return result;
3055 }
3056
3061 friend basic_string operator +(const std::basic_string<char>& lhs, const basic_string & rhs) {
3062 auto result = lhs;
3063 if constexpr(std::is_same_v<char, char_t>) result += rhs.chars();
3064 else result += __xtd_convert_to_string<char>(rhs.chars());
3065 return result;
3066 }
3071 friend basic_string operator +(const std::basic_string<xtd::char16>& lhs, const basic_string & rhs) {
3072 auto result = lhs;
3073 if constexpr(std::is_same_v<xtd::char16, char_t>) result += rhs.chars();
3074 else result += __xtd_convert_to_string<xtd::char16>(rhs.chars());
3075 return result;
3076 }
3081 friend basic_string operator +(const std::basic_string<xtd::char32>& lhs, const basic_string & rhs) {
3082 auto result = lhs;
3083 if constexpr(std::is_same_v<xtd::char32, char_t>) result += rhs.chars();
3084 else result += __xtd_convert_to_string<xtd::char32>(rhs.chars());
3085 return result;
3086 }
3091 friend basic_string operator +(const std::basic_string<xtd::char8>& lhs, const basic_string & rhs) {
3092 auto result = lhs;
3093 if constexpr(std::is_same_v<xtd::char8, char_t>) result += rhs.chars();
3094 else result += __xtd_convert_to_string<xtd::char8>(rhs.chars());
3095 return result;
3096 }
3101 friend basic_string operator +(const std::basic_string<xtd::wchar>& lhs, const basic_string & rhs) {
3102 auto result = lhs;
3103 if constexpr(std::is_same_v<xtd::wchar, char_t>) result += rhs.chars();
3104 else result += __xtd_convert_to_string<xtd::wchar>(rhs.chars());
3105 return result;
3106 }
3107
3112 friend basic_string operator +(const basic_string & lhs, const char* rhs) {
3113 auto result = lhs;
3114 result += rhs;
3115 return result;
3116 }
3121 friend basic_string operator +(const basic_string & lhs, const xtd::char16 * rhs) {
3122 auto result = lhs;
3123 result += rhs;
3124 return result;
3125 }
3130 friend basic_string operator +(const basic_string & lhs, const xtd::char32 * rhs) {
3131 auto result = lhs;
3132 result += rhs;
3133 return result;
3134 }
3139 friend basic_string operator +(const basic_string & lhs, const xtd::char8 * rhs) {
3140 auto result = lhs;
3141 result += rhs;
3142 return result;
3143 }
3148 friend basic_string operator +(const basic_string & lhs, const xtd::wchar * rhs) {
3149 auto result = lhs;
3150 result += rhs;
3151 return result;
3152 }
3153
3158 friend basic_string operator +(basic_string&& lhs, const char* rhs) {
3159 auto result = std::move(lhs);
3160 result += rhs;
3161 return result;
3162 }
3167 friend basic_string operator +(basic_string&& lhs, const xtd::char16 * rhs) {
3168 auto result = std::move(lhs);
3169 result += rhs;
3170 return result;
3171 }
3176 friend basic_string operator +(basic_string&& lhs, const xtd::char32 * rhs) {
3177 auto result = std::move(lhs);
3178 result += rhs;
3179 return result;
3180 }
3185 friend basic_string operator +(basic_string&& lhs, const xtd::char8 * rhs) {
3186 auto result = std::move(lhs);
3187 result += rhs;
3188 return result;
3189 }
3194 friend basic_string operator +(basic_string&& lhs, const xtd::wchar * rhs) {
3195 auto result = std::move(lhs);
3196 result += rhs;
3197 return result;
3198 }
3199
3204 friend basic_string operator +(const char* lhs, const basic_string & rhs) {
3205 auto result = basic_string(lhs);
3206 result += rhs;
3207 return result;
3208 }
3213 friend basic_string operator +(const xtd::char16 * lhs, const basic_string & rhs) {
3214 auto result = basic_string(lhs);
3215 result += rhs;
3216 return result;
3217 }
3222 friend basic_string operator +(const xtd::char32 * lhs, const basic_string & rhs) {
3223 auto result = basic_string(lhs);
3224 result += rhs;
3225 return result;
3226 }
3231 friend basic_string operator +(const xtd::char8 * lhs, const basic_string & rhs) {
3232 auto result = basic_string(lhs);
3233 result += rhs;
3234 return result;
3235 }
3240 friend basic_string operator +(const xtd::wchar * lhs, const basic_string & rhs) {
3241 auto result = basic_string(lhs);
3242 result += rhs;
3243 return result;
3244 }
3245
3250 friend basic_string operator +(const char* lhs, basic_string&& rhs) {
3251 auto result = basic_string(lhs);
3252 result += std::move(rhs);
3253 return result;
3254 }
3259 friend basic_string operator +(const xtd::char16 * lhs, basic_string&& rhs) {
3260 auto result = basic_string(lhs);
3261 result += std::move(rhs);
3262 return result;
3263 }
3268 friend basic_string operator +(const xtd::char32 * lhs, basic_string&& rhs) {
3269 auto result = basic_string(lhs);
3270 result += std::move(rhs);
3271 return result;
3272 }
3277 friend basic_string operator +(const xtd::char8 * lhs, basic_string&& rhs) {
3278 auto result = basic_string(lhs);
3279 result += std::move(rhs);
3280 return result;
3281 }
3286 friend basic_string operator +(const xtd::wchar * lhs, basic_string&& rhs) {
3287 auto result = basic_string(lhs);
3288 result += std::move(rhs);
3289 return result;
3290 }
3291
3296 friend basic_string operator +(const basic_string & lhs, const char rhs) {
3297 auto result = lhs;
3298 result += rhs;
3299 return result;
3300 }
3305 friend basic_string operator +(const basic_string & lhs, const xtd::char16 rhs) {
3306 auto result = lhs;
3307 result += rhs;
3308 return result;
3309 }
3314 friend basic_string operator +(const basic_string & lhs, const xtd::char32 rhs) {
3315 auto result = lhs;
3316 result += rhs;
3317 return result;
3318 }
3323 friend basic_string operator +(const basic_string & lhs, const xtd::char8 rhs) {
3324 auto result = lhs;
3325 result += rhs;
3326 return result;
3327 }
3332 friend basic_string operator +(const basic_string & lhs, const xtd::wchar rhs) {
3333 auto result = lhs;
3334 result += rhs;
3335 return result;
3336 }
3337
3342 friend basic_string operator +(basic_string&& lhs, const char rhs) {
3343 auto result = std::move(lhs);
3344 result += rhs;
3345 return result;
3346 }
3351 friend basic_string operator +(basic_string&& lhs, const xtd::char16 rhs) {
3352 auto result = std::move(lhs);
3353 result += rhs;
3354 return result;
3355 }
3360 friend basic_string operator +(basic_string&& lhs, const xtd::char32 rhs) {
3361 auto result = std::move(lhs);
3362 result += rhs;
3363 return result;
3364 }
3369 friend basic_string operator +(basic_string&& lhs, const xtd::char8 rhs) {
3370 auto result = std::move(lhs);
3371 result += rhs;
3372 return result;
3373 }
3378 friend basic_string operator +(basic_string&& lhs, const xtd::wchar rhs) {
3379 auto result = std::move(lhs);
3380 result += rhs;
3381 return result;
3382 }
3383
3388 friend basic_string operator +(char lhs, const basic_string & rhs) {
3389 auto result = basic_string(1, lhs);
3390 result += rhs;
3391 return result;
3392 }
3397 friend basic_string operator +(xtd::char16 lhs, const basic_string & rhs) {
3398 auto result = basic_string(1, lhs);
3399 result += rhs;
3400 return result;
3401 }
3406 friend basic_string operator +(xtd::char32 lhs, const basic_string & rhs) {
3407 auto result = basic_string(1, lhs);
3408 result += rhs;
3409 return result;
3410 }
3415 friend basic_string operator +(xtd::char8 lhs, const basic_string & rhs) {
3416 auto result = basic_string(1, lhs);
3417 result += rhs;
3418 return result;
3419 }
3424 friend basic_string operator +(xtd::wchar lhs, const basic_string & rhs) {
3425 auto result = basic_string(1, lhs);
3426 result += rhs;
3427 return result;
3428 }
3429
3434 friend basic_string operator +(char lhs, basic_string&& rhs) {
3435 auto result = basic_string(1, lhs);
3436 result += std::move(rhs);
3437 return result;
3438 }
3443 friend basic_string operator +(xtd::char16 lhs, basic_string&& rhs) {
3444 auto result = basic_string(1, lhs);
3445 result += std::move(rhs);
3446 return result;
3447 }
3452 friend basic_string operator +(xtd::char32 lhs, basic_string&& rhs) {
3453 auto result = basic_string(1, lhs);
3454 result += std::move(rhs);
3455 return result;
3456 }
3461 friend basic_string operator +(xtd::char8 lhs, basic_string&& rhs) {
3462 auto result = basic_string(1, lhs);
3463 result += std::move(rhs);
3464 return result;
3465 }
3470 friend basic_string operator +(xtd::wchar lhs, basic_string&& rhs) {
3471 auto result = basic_string(1, lhs);
3472 result += std::move(rhs);
3473 return result;
3474 }
3475
3484 //friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string& str) {return stream << str.to_string().chars_;}
3485 friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string & str) {
3486 if constexpr(std::is_same_v<char, char_t>) return stream << str.chars();
3487 else return stream << __xtd_convert_to_string<char>(str.chars());
3488 }
3495 friend std::basic_ostream<xtd::wchar>& operator <<(std::basic_ostream<xtd::wchar>& stream, const basic_string & str) {return stream << str.to_wstring().chars();}
3496
3505 friend std::basic_istream<char>& operator >>(std::basic_istream<char>& stream, basic_string & str) {
3506 auto s = std::basic_string<char> {};
3507 stream >> s;
3508 str = s;
3509 return stream;
3510 }
3519 friend std::basic_istream<xtd::wchar>& operator >>(std::basic_istream<xtd::wchar>& stream, basic_string & str) {
3520 auto s = std::basic_string<xtd::wchar> {};
3521 stream >> s;
3522 str = s;
3523 return stream;
3524 }
3526
3528
3532 [[deprecated("Replaced by xtd::basic_string::is_empty(const xtd::basic_string&) - Will be removed in version 0.4.0.")]]
3533 bool is_empty() const noexcept {return is_empty(self_);}
3539
3541
3542 template<class object_t>
3543 [[deprecated("Replaced by typeof_<object_t>().name() - Will be removed in version 0.4.0.")]]
3544 static basic_string class_name() {return get_class_name(full_class_name<object_t>());}
3549 template<class object_t>
3550 [[deprecated("Replaced by typeof_(object).name() - Will be removed in version 0.4.0.")]]
3551 static basic_string class_name(const object_t& object) {return get_class_name(full_class_name(object));}
3556 [[deprecated("Replaced by typeof_(info).name() - Will be removed in version 0.4.0.")]]
3557 static basic_string class_name(const std::type_info & info) {return __xtd_get_class_name(info);}
3562 template<class object_t>
3563 [[deprecated("Replaced by typeof_<object_t>().full_name() - Will be removed in version 0.4.0.")]]
3564 static basic_string full_class_name() {return demangle(typeid(object_t).name());}
3569 template<class object_t>
3570 [[deprecated("Replaced by typeof_(object).full_name() - Will be removed in version 0.4.0.")]]
3571 static basic_string full_class_name(const object_t& object) {return demangle(typeid(object).name());}
3576 [[deprecated("Replaced by typeof_(info).full_name() - Will be removed in version 0.4.0.")]]
3577 static basic_string full_class_name(const std::type_info & info) {return __xtd_get_full_class_name(info);}
3579
3580 private:
3581 friend class basic_string<char>;
3582 friend class basic_string<xtd::char16>;
3583 friend class basic_string<xtd::char32>;
3584 friend class basic_string<xtd::char8>;
3585 friend class basic_string<xtd::wchar>;
3586
3587 static const xtd::array<value_type> default_split_separators;
3588 static const xtd::array<value_type> default_trim_chars;
3589
3590 template<class arg_t>
3591 inline static auto convert_param(arg_t&& arg) noexcept {
3592 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();
3593 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();
3594 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();
3595 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();
3596 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();
3597 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();
3598 else return std::forward<arg_t>(arg);
3599 }
3600
3601 static basic_string get_class_name(const basic_string & full_name) {
3602 auto length = full_name.last_index_of("<");
3603 if (length == npos) length = full_name.length();
3604 if (full_name.last_index_of("::", 0, length) == npos) return full_name;
3605 return full_name.substring(full_name.last_index_of("::", 0, length) + 2);
3606 }
3607
3608 base_type chars_;
3609 };
3610}
3611
3612#define __XTD_BASIC_STRING_INTERNAL__
3613#include "basic_string_.hpp"
3614#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:64
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:1397
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:1521
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:3551
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:1409
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:1402
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:1632
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:1460
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:3577
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:1444
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:1467
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:1548
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:1569
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:1574
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:1475
static basic_string class_name()
Gets the class name of the object_t.
Definition basic_string.hpp:3544
static basic_string class_name(const std::type_info &info)
Gets the class name of the specified object.
Definition basic_string.hpp:3557
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:3533
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:1553
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:1542
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:1591
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:1489
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:1389
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:1377
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:1585
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:1535
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:3564
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:3571
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:1454
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:1528
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:1382
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:1559
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:1481
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:1639
auto count() const noexcept -> xtd::size
Definition enumerable.hpp:209
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
@ invalid_operation
The operation is not valid.
Definition exception_case.hpp:65
#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.