xtd 1.0.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__
18#include "basic_string_view.hpp"
19#include "character.hpp"
20#include "hash_code.hpp"
21#include "icomparable.hpp"
22#include "iequatable.hpp"
23#include "null.hpp"
24#include "string_comparison.hpp"
26#include "types.hpp"
27#include "object.hpp"
28#include "parse.hpp"
29#include "types.hpp"
30#include <cctype>
31#include <iomanip>
32#include <ostream>
33#include <sstream>
34#include <string>
35
37template<typename ...args_t>
38void __basic_string_extract_format_arg(const std::locale& loc, xtd::basic_string<char>& fmt, xtd::array<__format_information<char >>& formats, args_t&&... args);
39template<typename target_t, typename source_t>
40std::basic_string<target_t> __xtd_convert_to_string(std::basic_string<source_t>&& str) noexcept;
41template<typename target_t, typename source_t>
42std::basic_string<target_t> __xtd_convert_to_string(const std::basic_string<source_t>& str) noexcept;
43std::basic_string<char> __xtd_demangle(const std::basic_string<char>& value) noexcept;
44std::basic_string<char> __xtd_get_class_name(const std::type_info& value) noexcept;
45std::basic_string<char> __xtd_get_full_class_name(const std::type_info& value) noexcept;
47
49namespace xtd {
51 struct index;
52 class range;
54
73 template<typename char_t, typename traits_t, typename allocator_t>
74 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> {
75 public:
77
81 using base_type = std::basic_string<char_t, traits_t, allocator_t>;
83 using traits_type = typename base_type::traits_type;
85 using value_type = typename base_type::value_type;
87 using allocator_type = typename base_type::allocator_type;
89 using size_type = typename base_type::size_type;
91 using difference_type = typename base_type::difference_type;
93 using reference = typename base_type::reference;
95 using const_reference = typename base_type::const_reference;
97 using pointer = typename base_type::pointer;
99 using const_pointer = typename base_type::const_pointer;
107 using reverse_iterator = typename base_type::reverse_iterator;
109 using const_reverse_iterator = typename base_type::const_reverse_iterator;
113
115
120
129 inline static constexpr size_type npos = base_type::npos;
131
133
136 basic_string() = default;
142 basic_string(std::basic_string<char_t>&& str) : chars_ {std::move(str)} {}
145 basic_string(const basic_string<char>& str) noexcept {
146 if constexpr(std::is_same_v<char, char_t>) chars_ = str.chars_;
147 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
148 }
149
152 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = str.chars_;
153 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
154 }
155
158 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = str.chars_;
159 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
160 }
161
164 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = str.chars_;
165 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
166 }
167
170 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = str.chars_;
171 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
172 }
173
175 basic_string(const std::basic_string<char>& str) noexcept { // Can't be explicit by design.
176 if constexpr(std::is_same_v<char, char_t>) chars_ = str;
177 else chars_ = __xtd_convert_to_string<value_type>(str);
178 }
179
181 basic_string(const std::basic_string<xtd::char16>& str) noexcept { // Can't be explicit by design.
182 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = str;
183 else chars_ = __xtd_convert_to_string<value_type>(str);
184 }
185
187 basic_string(const std::basic_string<xtd::char32>& str) noexcept { // Can't be explicit by design.
188 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = str;
189 else chars_ = __xtd_convert_to_string<value_type>(str);
190 }
191
193 basic_string(const std::basic_string<xtd::char8>& str) noexcept { // Can't be explicit by design.
194 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = str;
195 else chars_ = __xtd_convert_to_string<value_type>(str);
196 }
197
199 basic_string(const std::basic_string<xtd::wchar>& str) noexcept { // Can't be explicit by design.
200 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = str;
201 else chars_ = __xtd_convert_to_string<value_type>(str);
202 }
203
225 basic_string(const char* str) { // Can't be explicit by design.
227 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str);
228 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str));
229 }
230
232 basic_string(const xtd::char16* str) { // Can't be explicit by design.
234 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str);
235 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str));
236 }
237
239 basic_string(const xtd::char32* str) { // Can't be explicit by design.
241 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str);
242 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str));
243 }
244
246 basic_string(const xtd::char8* str) { // Can't be explicit by design.
248 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str);
249 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str));
250 }
251
253 basic_string(const xtd::wchar* str) { // Can't be explicit by design.
255 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
256 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
257 }
258
261 basic_string(const char* str, xtd::usize count) {
263 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str, count);
264 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str, count));
265 }
266
270 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str, count);
271 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str, count));
272 }
273
277 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str, count);
278 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str, count));
279 }
280
284 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str, count);
285 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str, count));
286 }
287
291 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str, count);
292 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str, count));
293 }
294
297 template<typename input_iterator_t>
298 basic_string(input_iterator_t first, input_iterator_t last) : chars_(first, last) {}
301 basic_string(const xtd::collections::generic::ienumerable<char_t>& items) : chars_(items.begin(), items.end()) {}
304 basic_string(const xtd::basic_string_view<char_t>& str) : chars_(str) {}
307 //basic_string(const xtd::basic_read_only_string_view<char_t>& str) : chars_(str) {}
310 basic_string(std::initializer_list<char> il) : basic_string(std::basic_string<char>(il)) {}
313 basic_string(std::initializer_list<xtd::char16> il) : basic_string(std::basic_string<xtd::char16>(il)) {}
316 basic_string(std::initializer_list<xtd::char32> il) : basic_string(std::basic_string<xtd::char32>(il)) {}
319 basic_string(std::initializer_list<xtd::char8> il) : basic_string(std::basic_string<xtd::char8>(il)) {}
322 basic_string(std::initializer_list<xtd::wchar> il) : basic_string(std::basic_string<xtd::wchar>(il)) {}
324
326
336 [[nodiscard]] auto c_str() const noexcept -> const_pointer {return chars_.c_str();}
337
340 [[nodiscard]] auto chars() const noexcept -> const base_type& {return chars_;}
343 [[nodiscard]] auto chars() noexcept -> base_type& {return chars_;}
344
348 [[nodiscard]] virtual auto count() const noexcept -> size_type {return chars_.size();}
349
357 [[nodiscard]] auto data() const noexcept -> const_pointer {return chars_.data();}
358
361 [[nodiscard]] virtual auto empty() const noexcept -> bool {return length() == 0;}
362
366 [[nodiscard]] virtual auto length() const noexcept -> size_type {return chars_.size();}
367
371 [[nodiscard]] virtual auto size() const noexcept -> size_type {return chars_.size();}
373
375
386 [[nodiscard]] auto compare_to(const object& value) const -> xtd::int32 {
388 return compare_to(static_cast<const basic_string&>(value));
389 }
390
398 [[nodiscard]] auto compare_to(const basic_string& value) const noexcept -> xtd::int32 override {return chars_.compare(value.chars_);}
399
403 [[nodiscard]] virtual auto contains(value_type value) const noexcept -> bool {return chars_.find(value) != npos;}
407 [[nodiscard]] virtual auto contains(const basic_string& value) const noexcept -> bool {return chars_.find(value) != npos;}
408
412 [[nodiscard]] auto equals(const object& obj) const noexcept -> bool override {return dynamic_cast<const basic_string*>(&obj) && equals(static_cast<const basic_string&>(obj));}
417 [[nodiscard]] auto equals(const basic_string& value) const noexcept -> bool override {return equals(value, false);}
423 [[nodiscard]] auto equals(const basic_string& value, bool ignore_case) const noexcept -> bool {
424 if (ignore_case) return to_upper().chars_ == value.to_upper().chars_;
425 return chars_ == value.chars_;
426 }
427
431 [[nodiscard]] auto ends_with(value_type value) const noexcept -> bool {return ends_with(value, false);}
436 [[nodiscard]] auto ends_with(value_type value, bool ignore_case) const noexcept -> bool {
437 if (ignore_case) return to_lower().chars_.rfind(static_cast<value_type>(tolower(value))) == length() - 1;
438 return chars_.rfind(value) == length() - 1;
439 }
440
443 [[nodiscard]] auto ends_with(const basic_string& value) const noexcept -> bool {return ends_with(value, xtd::string_comparison::ordinal);}
448 [[nodiscard]] auto ends_with(const basic_string& value, bool ignore_case) const noexcept -> bool {return ends_with(value, ignore_case ? xtd::string_comparison::ordinal_ignore_case : xtd::string_comparison::ordinal);}
453 [[nodiscard]] auto ends_with(const basic_string& value, xtd::string_comparison comparison_type) const noexcept -> bool {
454 if (comparison_type == xtd::string_comparison::ordinal_ignore_case) return to_lower().chars_.rfind(value.to_lower()) + value.to_lower().length() == length();
455 return chars_.rfind(value) + value.length() == length();
456 }
457
460 [[nodiscard]] virtual auto get_base_type() const noexcept -> const base_type& {return chars_;}
461
464 [[nodiscard]] auto get_hash_code() const noexcept -> xtd::usize override {return xtd::hash_code::combine(chars_);}
465
466 [[nodiscard]] auto get_enumerator() const noexcept -> enumerator_type override {
467 struct basic_string_enumerator : public xtd::collections::generic::ienumerator<value_type> {
468 explicit basic_string_enumerator(const basic_string& chars) : chars_(chars) {}
469 [[nodiscard]] const value_type& current() const override {
471 return chars_[index_];
472 }
473 bool move_next() override {return ++index_ < chars_.length();}
474 void reset() override {index_ = basic_string::npos;}
475
476 private:
477 const basic_string& chars_;
479 };
481 }
482
486 [[nodiscard]] auto index_of(const basic_string& value) const noexcept -> xtd::usize {return index_of(value, 0, length());}
491 [[nodiscard]] auto index_of(const basic_string& value, xtd::usize start_index) const -> xtd::usize {return index_of(value, start_index, length() - start_index);}
498 [[nodiscard]] auto index_of(const basic_string& value, xtd::usize start_index, xtd::usize count) const -> xtd::usize {
500 auto result = chars_.find(value, start_index);
501 return result > start_index + count ? npos : result;
502 }
503
506 [[nodiscard]] auto index_of(value_type value) const noexcept -> xtd::usize {return index_of(value, 0, length());}
511 [[nodiscard]] auto index_of(value_type value, xtd::usize start_index) const -> xtd::usize {return index_of(value, start_index, length() - start_index);}
518 [[nodiscard]] auto index_of(value_type value, xtd::usize start_index, xtd::usize count) const -> xtd::usize {
520 auto result = chars_.find(value, start_index);
521 return result > start_index + count ? npos : result;
522 }
523
527 [[nodiscard]] auto index_of_any(const xtd::array<value_type>& values) const noexcept -> xtd::usize;
533 [[nodiscard]] auto index_of_any(const xtd::array<value_type>& values, xtd::usize start_index) const -> xtd::usize;
540 [[nodiscard]] auto index_of_any(const xtd::array<value_type>& values, xtd::usize start_index, xtd::usize count) const -> xtd::usize;
542 [[nodiscard]] auto index_of_any(const std::initializer_list<value_type>& values) const noexcept -> xtd::usize;
543 [[nodiscard]] auto index_of_any(const std::initializer_list<value_type>& values, xtd::usize start_index) const -> xtd::usize;
544 [[nodiscard]] auto index_of_any(const std::initializer_list<value_type>& values, xtd::usize start_index, xtd::usize count) const -> xtd::usize;
546
553 auto insert(xtd::usize start_index, const basic_string& value) const -> basic_string {
555 auto result = self_;
556 result.chars_.insert(start_index, value);
557 return result;
558 }
559
563 [[nodiscard]] auto last_index_of(const basic_string& value) const noexcept -> xtd::usize {return last_index_of(value, 0, length());}
569 [[nodiscard]] auto last_index_of(const basic_string& value, xtd::usize start_index) const -> xtd::usize {return last_index_of(value, start_index, length() - start_index);}
576 [[nodiscard]] auto last_index_of(const basic_string& value, xtd::usize start_index, xtd::usize count) const -> xtd::usize {
578 auto result = chars_.rfind(value, start_index + count - value.length());
579 return result < start_index ? npos : result;
580 }
581
584 [[nodiscard]] auto last_index_of(value_type value) const noexcept -> xtd::usize {return last_index_of(value, 0, length());}
590 [[nodiscard]] auto last_index_of(value_type value, xtd::usize start_index) const -> xtd::usize {return last_index_of(value, start_index, length() - start_index);}
598 [[nodiscard]] auto last_index_of(value_type value, xtd::usize start_index, xtd::usize count) const -> xtd::usize {
600 auto result = chars_.rfind(value, start_index + count - 1);
601 return result < start_index ? npos : result;
602 }
603
607 [[nodiscard]] auto last_index_of_any(const xtd::array<value_type>& values) const noexcept -> xtd::usize;
612 [[nodiscard]] auto last_index_of_any(const xtd::array<value_type>& values, xtd::usize start_index) const -> xtd::usize;
618 [[nodiscard]] auto last_index_of_any(const xtd::array<value_type>& values, xtd::usize start_index, xtd::usize count) const -> xtd::usize;
620 [[nodiscard]] auto last_index_of_any(const std::initializer_list<value_type>& values) const noexcept -> xtd::usize;
621 [[nodiscard]] auto last_index_of_any(const std::initializer_list<value_type>& values, xtd::usize start_index) const -> xtd::usize;
622 [[nodiscard]] auto last_index_of_any(const std::initializer_list<value_type>& values, xtd::usize start_index, xtd::usize count) const -> xtd::usize;
624
630 [[nodiscard]] auto pad_left(xtd::usize total_width) const noexcept -> basic_string {return pad_left(total_width, ' ');}
637 [[nodiscard]] auto pad_left(xtd::usize total_width, char32 padding_char) const noexcept -> basic_string {return total_width < length() ? self_ : basic_string(padding_char, total_width - length()) + self_;}
638
644 [[nodiscard]] auto pad_right(xtd::usize total_width) const noexcept -> basic_string {return pad_right(total_width, ' ');}
651 [[nodiscard]] auto pad_right(xtd::usize total_width, char32 padding_char) const noexcept -> basic_string {return total_width < length() ? self_ : self_ + basic_string(padding_char, total_width - length());}
652
657 [[nodiscard]] auto quoted() const -> basic_string {return quoted('"', '\\');}
662 [[nodiscard]] auto quoted(value_type delimiter) const -> basic_string {return quoted(delimiter, '\\');}
668 [[nodiscard]] auto quoted(value_type delimiter, value_type escape) const -> basic_string {
669 std::wstringstream ss;
670 if constexpr(std::is_same_v<xtd::wchar, value_type>) ss << std::quoted(chars_, delimiter, escape);
671 else ss << std::quoted(__xtd_convert_to_string<xtd::wchar>(chars_), static_cast<xtd::wchar>(delimiter), static_cast<xtd::wchar>(escape));
672 return ss.str();
673 }
674
678 [[nodiscard]] auto remove(xtd::usize start_index) const -> basic_string {return remove(start_index, length() - start_index);}
683 [[nodiscard]] auto remove(xtd::usize start_index, xtd::usize count) const -> basic_string {
685 auto result = self_;
686 result.chars_.erase(start_index, count);
687 return result;
688 }
689
694 [[nodiscard]] auto replace(value_type old_char, value_type new_char) const noexcept -> basic_string {return replace(string(old_char, 1), string(new_char, 1));}
700 [[nodiscard]] auto replace(const basic_string& old_string, const basic_string& new_string) const noexcept -> basic_string {
701 auto result = self_;
702 auto old_size = old_string.length();
703 auto new_size = new_string.length();
704 auto index = xtd::usize {0};
705 while (true) {
706 index = result.chars_.find(old_string, index);
707 if (index == npos) break;
708 if (old_size == new_size) result.chars_.replace(index, old_size, new_string);
709 else {
710 result.chars_.erase(index, old_string.length());
711 result.chars_.insert(index, new_string);
712 }
713 index += new_string.length();
714 }
715 return result;
716 }
717
722 [[nodiscard]] auto split() const noexcept -> xtd::array<basic_string>;
728 [[nodiscard]] auto split(value_type separator) const noexcept -> xtd::array<basic_string>;
745 [[nodiscard]] auto split(value_type separator, xtd::string_split_options options) const noexcept -> xtd::array<basic_string>;
754 [[nodiscard]] auto split(value_type separator, xtd::usize count) const noexcept -> xtd::array<basic_string>;
766 [[nodiscard]] auto split(value_type separator, xtd::usize count, xtd::string_split_options options) const noexcept -> xtd::array<basic_string>;
772 [[nodiscard]] auto split(const xtd::array<value_type>& separators) const noexcept -> xtd::array<basic_string>;
789 [[nodiscard]] auto split(const xtd::array<value_type>& separators, xtd::string_split_options options) const noexcept -> xtd::array<basic_string>;
798 [[nodiscard]] auto split(const xtd::array<value_type>& separators, xtd::usize count) const noexcept -> xtd::array<basic_string>;
810 [[nodiscard]] auto split(const xtd::array<value_type>& separators, xtd::usize count, xtd::string_split_options options) const noexcept -> xtd::array<basic_string>;
811
816 [[nodiscard]] bool starts_with(value_type value) const noexcept {return starts_with(value, false);}
822 [[nodiscard]] bool starts_with(value_type value, bool ignore_case) const noexcept {
823 if (ignore_case) return to_lower().chars_.find(static_cast<value_type>(tolower(value))) == 0;
824 return chars_.find(value) == 0;
825 }
826
830 [[nodiscard]] auto starts_with(const basic_string& value) const noexcept -> bool {return starts_with(value, string_comparison::ordinal);}
836 [[nodiscard]] auto starts_with(const basic_string& value, bool ignore_case) const noexcept -> bool {return starts_with(value, ignore_case ? string_comparison::ordinal_ignore_case : string_comparison::ordinal);}
841 [[nodiscard]] auto starts_with(const basic_string& value, xtd::string_comparison comparison_type) const noexcept -> bool {
842 if (comparison_type == xtd::string_comparison::ordinal_ignore_case) return to_lower().chars_.find(value.to_lower()) == 0;
843 return chars_.find(value) == 0;
844 }
845
851 [[nodiscard]] auto substring(xtd::usize start_index) const -> basic_string {
853 return chars_.substr(start_index);
854 }
855
860 [[nodiscard]] auto substring(xtd::usize start_index, xtd::usize length) const -> basic_string {
862 return chars_.substr(start_index, length);
863 }
864
867 [[nodiscard]] auto to_array() const noexcept -> xtd::array<value_type>;
871 [[nodiscard]] auto to_array(xtd::usize start_index) const -> xtd::array<value_type>;
876 [[nodiscard]] auto to_array(xtd::usize start_index, xtd::usize length) const -> xtd::array<value_type>;
877
880 [[nodiscard]] auto to_char_array() const noexcept -> xtd::array<value_type>;
885 [[nodiscard]] auto to_char_array(xtd::usize start_index, xtd::usize length) const -> xtd::array<value_type>;
886
889 [[nodiscard]] auto to_lower() const noexcept -> basic_string {
890 auto result = basic_string::empty_string;
891 std::for_each(chars_.begin(), chars_.end(), [&](auto c) {result += static_cast<value_type>(std::tolower(c));});
892 return result;
893 }
894
898 [[nodiscard]] auto to_string() const noexcept -> basic_string<char> override {
899 if constexpr(std::is_same_v<char, char_t>) return chars_;
900 else return __xtd_convert_to_string<char>(chars_);
901 }
902
905 [[nodiscard]] auto to_title_case() const noexcept -> basic_string;
906
909 [[nodiscard]] auto to_u16string() const noexcept -> basic_string<xtd::char16> {
910 if constexpr(std::is_same_v<xtd::char16, char_t>) return chars_;
911 else return __xtd_convert_to_string<xtd::char16>(chars_);
912 }
913
916 [[nodiscard]] auto to_u32string() const noexcept -> basic_string<xtd::char32> {
917 if constexpr(std::is_same_v<xtd::char32, char_t>) return chars_;
918 else return __xtd_convert_to_string<xtd::char32>(chars_);
919 }
920
923 [[nodiscard]] auto to_u8string() const noexcept -> basic_string<xtd::char8> {
924 if constexpr(std::is_same_v<xtd::char8, char_t>) return chars_;
925 else return __xtd_convert_to_string<xtd::char8>(chars_);
926 }
927
930 [[nodiscard]] auto to_upper() const noexcept -> basic_string {
931 auto result = basic_string::empty_string;
932 std::for_each(chars_.begin(), chars_.end(), [&](auto c) {result += static_cast<value_type>(std::toupper(c));});
933 return result;
934 }
935
938 [[nodiscard]] auto to_wstring() const noexcept -> basic_string<xtd::wchar> {
939 if constexpr(std::is_same_v<xtd::wchar, char_t>) return chars_;
940 else return __xtd_convert_to_string<xtd::wchar>(chars_);
941 }
942
947 [[nodiscard]] auto trim() const noexcept -> basic_string {return trim(default_trim_chars);}
952 [[nodiscard]] auto trim(value_type trim_char) const noexcept -> basic_string;
957 [[nodiscard]] auto trim(const xtd::array<value_type>& trim_chars) const noexcept -> basic_string;
958
963 [[nodiscard]] auto trim_end() const noexcept -> basic_string {return trim_end(default_trim_chars);}
968 [[nodiscard]] auto trim_end(value_type trim_char) const noexcept -> basic_string;
973 [[nodiscard]] auto trim_end(const xtd::array<value_type>& trim_chars) const noexcept -> basic_string;
974
979 [[nodiscard]] auto trim_start() const noexcept -> basic_string {return trim_start(default_trim_chars);}
984 [[nodiscard]] auto trim_start(value_type trim_char) const noexcept -> basic_string;
989 [[nodiscard]] auto trim_start(const xtd::array<value_type>& trim_chars) const noexcept -> basic_string;
991
993
1004 [[nodiscard]] static auto compare(const basic_string& str_a, const basic_string& str_b) noexcept -> xtd::int32 {return compare(str_a, str_b, false);}
1015 [[nodiscard]] static auto compare(const basic_string& str_a, const basic_string& str_b, bool ignore_case) noexcept -> xtd::int32 {return compare(str_a, str_b, ignore_case ? xtd::string_comparison::ordinal_ignore_case : xtd::string_comparison::ordinal);}
1026 [[nodiscard]] static auto compare(const basic_string& str_a, const basic_string& str_b, xtd::string_comparison comparison_type) noexcept -> xtd::int32 {return comparison_type == xtd::string_comparison::ordinal_ignore_case ? str_a.to_lower().chars_.compare(str_b.to_lower()) : str_a.chars_.compare(str_b);}
1039 [[nodiscard]] static auto compare(const basic_string& str_a, xtd::usize index_a, const basic_string& str_b, xtd::usize index_b, xtd::usize length) -> xtd::int32 {return compare(str_a, index_a, str_b, index_b, length, false);}
1053 [[nodiscard]] static auto compare(const basic_string& str_a, xtd::usize index_a, const basic_string& str_b, xtd::usize index_b, xtd::usize length, bool ignore_case) -> xtd::int32 {return compare(str_a, index_a, str_b, index_b, length, ignore_case ? xtd::string_comparison::ordinal_ignore_case : xtd::string_comparison::ordinal);}
1067 [[nodiscard]] static auto compare(const basic_string& str_a, xtd::usize index_a, const basic_string& str_b, xtd::usize index_b, xtd::usize length, xtd::string_comparison comparison_type) -> xtd::int32 {return comparison_type == xtd::string_comparison::ordinal_ignore_case ? str_a.substring(index_a, length).to_lower().chars_.compare(str_b.substring(index_b, length).to_lower()) : str_a.substring(index_a, length).chars_.compare(str_b.substring(index_b, length));}
1068
1075 [[nodiscard]] static auto concat(const basic_string& str_a, const basic_string& str_b, const basic_string& str_c, const basic_string& str_d) noexcept -> basic_string {return str_a + str_b + str_c + str_d;}
1082 template<typename object_a_t, typename object_b_t, typename object_c_t, typename object_d_t>
1083 [[nodiscard]] static auto concat(object_a_t obj_a, object_b_t obj_b, object_c_t obj_c, object_d_t obj_d) noexcept -> basic_string {return format("{}{}{}{}", obj_a, obj_b, obj_c, obj_d);}
1089 [[nodiscard]] static auto concat(const basic_string& str_a, const basic_string& str_b, const basic_string& str_c) noexcept -> basic_string {return str_a + str_b + str_c;}
1095 template<typename object_a_t, typename object_b_t, typename object_c_t>
1096 [[nodiscard]] static auto concat(object_a_t obj_a, object_b_t obj_b, object_c_t obj_c) noexcept -> basic_string {return format("{}{}{}", obj_a, obj_b, obj_c);}
1101 [[nodiscard]] static auto concat(const basic_string& str_a, const basic_string& str_b) noexcept -> basic_string {return str_a + str_b;}
1106 template<typename object_a_t, typename object_b_t>
1107 [[nodiscard]] static auto concat(object_a_t obj_a, object_b_t obj_b) noexcept -> basic_string {return format("{}{}", obj_a, obj_b);}
1111 [[nodiscard]] static auto concat(const xtd::array<basic_string>& values) noexcept -> basic_string;
1113 [[nodiscard]] static auto concat(const xtd::array<const_pointer>& values) noexcept -> basic_string;
1114 template<typename other_char_t>
1115 [[nodiscard]] static auto concat(const xtd::array<const other_char_t*>& values) noexcept -> basic_string;
1116 [[nodiscard]] static auto concat(const std::initializer_list<basic_string>& values) noexcept -> basic_string {
1117 auto result = basic_string::empty_string;
1118 std::for_each(values.begin(), values.end(), [&](const auto& item) {result += item;});
1119 return result;
1120 }
1121 [[nodiscard]] static auto concat(const std::initializer_list<const_pointer>& values) noexcept -> basic_string {
1122 auto result = basic_string::empty_string;
1123 std::for_each(values.begin(), values.end(), [&](const auto& item) {result += item;});
1124 return result;
1125 }
1126 template<typename other_char_t>
1127 [[nodiscard]] static auto concat(const std::initializer_list<const other_char_t*>& values) noexcept -> basic_string {
1128 auto result = basic_string::empty_string;
1129 std::for_each(values.begin(), values.end(), [&](const auto& item) {result += item;});
1130 return result;
1131 }
1136 template<typename object_t>
1137 [[nodiscard]] static auto concat(const xtd::array<object_t>& args) noexcept -> basic_string;
1139 template<typename object_t>
1140 [[nodiscard]] static auto concat(const std::initializer_list<object_t>& args) noexcept -> basic_string {
1141 basic_string result;
1142 for (const auto& arg : args)
1143 result += format("{}", arg);
1144 return result;
1145 }
1150 template<typename value_t>
1151 [[nodiscard]] static auto concat(value_t value) noexcept -> basic_string {
1152 return format("{}", value);
1153 }
1154
1175 [[nodiscard]] static auto demangle(const basic_string& name) -> basic_string {
1176 if constexpr(std::is_same_v<char, char_t>) return __xtd_demangle(name.chars());
1177 else return __xtd_demangle(__xtd_convert_to_string<char>(name.chars()));
1178 }
1179
1185 [[nodiscard]] static auto equals(const basic_string& a, const basic_string& b) noexcept -> bool {return a.equals(b);}
1191 template<typename char_a_t, typename char_b_t>
1192 [[nodiscard]] static auto equals(const char_a_t* a, const char_b_t* b) noexcept -> bool {return basic_string {a}.equals(basic_string {b});}
1193
1200 [[nodiscard]] static auto equals(const basic_string& a, const basic_string& b, bool ignore_case) noexcept -> bool {return a.equals(b, ignore_case);}
1207 template<typename char_a_t, typename char_b_t>
1208 [[nodiscard]] static auto equals(const char_a_t* a, const char_b_t* b, bool ignore_case) noexcept -> bool {return basic_string {a}.equals(basic_string {b}, ignore_case);}
1209
1216 template<typename ...args_t>
1217 [[nodiscard]] static auto format(const basic_string<char>& fmt, args_t&& ... args) -> basic_string;
1218
1226 template<typename ...args_t>
1227 [[nodiscard]] static auto format(const std::locale& loc, const basic_string<char>& fmt, args_t&& ... args) -> basic_string;
1228
1232 [[nodiscard]] static auto is_empty(const xtd::basic_string<value_type, traits_type, allocator_type>& string) noexcept -> bool {return !string.length();}
1233
1240 template<typename collection_t>
1241 [[nodiscard]] static auto join(const basic_string& separator, const collection_t& values) noexcept -> basic_string {
1242 xtd::usize i = 0;
1243 basic_string result;
1244 for (const auto& item : values)
1245 result += format("{}{}", (i++ != 0 ? separator : basic_string {}), item);
1246 return result;
1247 }
1248
1255 template<typename collection_t>
1256 [[nodiscard]] static auto join(const basic_string& separator, const collection_t& values, xtd::usize index) -> basic_string {return join(separator, values, index, values.size() - index);}
1265 template<typename collection_t>
1266 [[nodiscard]] static auto join(const basic_string& separator, const collection_t& values, xtd::usize index, xtd::usize count) -> basic_string {
1268 xtd::usize i = 0;
1269 basic_string result;
1270 for (const auto& item : values) {
1271 if (i >= index) result += format("{}{}", (i != index ? separator : basic_string {}), item);
1272 if (++i >= index + count) break;
1273 }
1274 return result;
1275 }
1276
1278 template<typename value_t>
1279 [[nodiscard]] static auto join(const basic_string& separator, const std::initializer_list<value_t>& values) noexcept -> basic_string;
1280 template<typename value_t>
1281 [[nodiscard]] static auto join(const basic_string& separator, const std::initializer_list<value_t>& values, xtd::usize index) -> basic_string;
1282 template<typename value_t>
1283 [[nodiscard]] static auto join(const basic_string& separator, const std::initializer_list<value_t>& values, xtd::usize index, xtd::usize count) -> basic_string;
1285
1289 template<typename value_t>
1290 [[nodiscard]] static auto parse(const basic_string& str) -> value_t {
1291 if constexpr(std::is_same_v<char, char_t>) return xtd::parse<value_t>(str.chars());
1292 else return xtd::parse<value_t>(__xtd_convert_to_string<char>(str.chars()));
1293 }
1294
1354 template<typename ...args_t>
1355 [[nodiscard]] static auto sprintf(const basic_string& fmt, args_t&& ... args) noexcept -> basic_string {return __sprintf(fmt.chars().c_str(), convert_param(std::forward<args_t>(args)) ...);}
1356
1361 template<typename value_t>
1362 [[nodiscard]] static auto try_parse(const basic_string& str, value_t& value) noexcept -> bool {
1363 try {
1364 value = parse<value_t>(str);
1365 return true;
1366 } catch (...) {
1367 return false;
1368 }
1369 }
1370
1371
1373
1383
1392
1398 return operator [](index);
1399 }
1400
1409
1412 operator const base_type& () const noexcept {return chars_;}
1413
1417 auto operator =(const basic_string<char>& str) noexcept -> basic_string& {
1418 if constexpr(std::is_same<char_t, char>::value) chars_ = str.chars_;
1419 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
1420 return self_;
1421 }
1422
1425 auto operator =(const basic_string<xtd::char16>& str) noexcept -> basic_string& {
1426 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str.chars_;
1427 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
1428 return self_;
1429 }
1430
1433 auto operator =(const basic_string<xtd::char32>& str) noexcept -> basic_string& {
1434 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str.chars_;
1435 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
1436 return self_;
1437 }
1438
1441 auto operator =(const basic_string<xtd::char8>& str) noexcept -> basic_string& {
1442 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str.chars_;
1443 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
1444 return self_;
1445 }
1446
1449 auto operator =(const basic_string<xtd::wchar>& str) noexcept -> basic_string& {
1450 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str.chars_;
1451 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
1452 return self_;
1453 }
1454
1458 auto operator =(basic_string<char>&& str) noexcept -> basic_string& {
1459 if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str.chars_);
1460 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
1461 return self_;
1462 }
1463
1467 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str.chars_);
1468 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
1469 return self_;
1470 }
1471
1475 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str.chars_);
1476 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
1477 return self_;
1478 }
1479
1483 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str.chars_);
1484 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
1485 return self_;
1486 }
1487
1491 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str.chars_);
1492 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
1493 return self_;
1494 }
1495
1499 auto operator =(const std::basic_string<char>& str) noexcept -> basic_string& {
1500 if constexpr(std::is_same<char_t, char>::value) chars_ = str;
1501 else chars_ = __xtd_convert_to_string<value_type>(str);
1502 return self_;
1503 }
1504
1507 auto operator =(const std::basic_string<xtd::char16>& str) noexcept -> basic_string& {
1508 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str;
1509 else chars_ = __xtd_convert_to_string<value_type>(str);
1510 return self_;
1511 }
1512
1515 auto operator =(const std::basic_string<xtd::char32>& str) noexcept -> basic_string& {
1516 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str;
1517 else chars_ = __xtd_convert_to_string<value_type>(str);
1518 return self_;
1519 }
1520
1523 auto operator =(const std::basic_string<xtd::char8>& str) noexcept -> basic_string& {
1524 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str;
1525 else chars_ = __xtd_convert_to_string<value_type>(str);
1526 return self_;
1527 }
1528
1531 auto operator =(const std::basic_string<xtd::wchar>& str) noexcept -> basic_string& {
1532 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str;
1533 else chars_ = __xtd_convert_to_string<value_type>(str);
1534 return self_;
1535 }
1536
1540 auto operator =(std::basic_string<char>&& str) noexcept -> basic_string& {
1541 if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str);
1542 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
1543 return self_;
1544 }
1545
1548 auto operator =(std::basic_string<xtd::char16>&& str) noexcept -> basic_string& {
1549 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str);
1550 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
1551 return self_;
1552 }
1553
1556 auto operator =(std::basic_string<xtd::char32>&& str) noexcept -> basic_string& {
1557 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str);
1558 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
1559 return self_;
1560 }
1561
1564 auto operator =(std::basic_string<xtd::char8>&& str) noexcept -> basic_string& {
1565 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str);
1566 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
1567 return self_;
1568 }
1569
1572 auto operator =(std::basic_string<xtd::wchar>&& str) noexcept -> basic_string& {
1573 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str);
1574 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
1575 return self_;
1576 }
1577
1582 auto operator =(const char* str) -> basic_string& {
1584 if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str);
1585 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str));
1586 return self_;
1587 }
1588
1592 auto operator =(const xtd::char16* str) -> basic_string& {
1594 if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str);
1595 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str));
1596 return self_;
1597 }
1598
1602 auto operator =(const xtd::char32* str) -> basic_string& {
1604 if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str);
1605 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str));
1606 return self_;
1607 }
1608
1612 auto operator =(const xtd::char8* str) -> basic_string& {
1614 if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str);
1615 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str));
1616 return self_;
1617 }
1618
1622 auto operator =(const xtd::wchar* str) -> basic_string& {
1624 if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
1625 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
1626 return self_;
1627 }
1628
1634 return self_;
1635 }
1636
1641 return self_;
1642 }
1643
1648 return self_;
1649 }
1650
1655 return self_;
1656 }
1657
1662 return self_;
1663 }
1664
1668 auto operator =(const std::initializer_list<char>& il) -> basic_string& {
1669 self_ = basic_string(il);
1670 return self_;
1671 }
1672
1675 auto operator =(const std::initializer_list<xtd::char16>& il) -> basic_string& {
1676 self_ = basic_string(il);
1677 return self_;
1678 }
1679
1682 auto operator =(const std::initializer_list<xtd::char32>& il) -> basic_string& {
1683 self_ = basic_string(il);
1684 return self_;
1685 }
1686
1689 auto operator =(const std::initializer_list<xtd::char8>& il) -> basic_string& {
1690 self_ = basic_string(il);
1691 return self_;
1692 }
1693
1696 auto operator =(const std::initializer_list<xtd::wchar>& il) -> basic_string& {
1697 self_ = basic_string(il);
1698 return self_;
1699 }
1700
1704 template<xtd::character other_char_t>
1706 if constexpr(std::is_same_v<other_char_t, char_t>) chars_ += str.chars_;
1707 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
1708 return self_;
1709 }
1710
1714 template<xtd::character other_char_t>
1716 if constexpr(std::is_same_v<other_char_t, char_t>) chars_ += std::move(str.chars_);
1717 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
1718 return self_;
1719 }
1720
1724 template<xtd::character other_char_t>
1725 auto operator +=(const std::basic_string<other_char_t>& str) -> basic_string& {
1726 if constexpr(std::is_same_v<other_char_t, char_t>) chars_ += str;
1727 else chars_ += __xtd_convert_to_string<value_type>(str);
1728 return self_;
1729 }
1730
1734 template<xtd::character other_char_t>
1735 auto operator +=(const other_char_t* str) -> basic_string& {
1736 chars_ += basic_string(str).chars_;
1737 return self_;
1738 }
1739
1743 template<xtd::character other_char_t>
1744 auto operator +=(other_char_t ch) -> basic_string& {
1745 chars_ += basic_string(ch, 1).chars_;
1746 return self_;
1747 }
1748
1753 template<xtd::character other_char_t>
1754 friend auto operator +(const basic_string& lhs, const basic_string<other_char_t>& rhs) -> basic_string {
1755 auto result = lhs;
1756 result += rhs;
1757 return result;
1758 }
1759
1764 template<xtd::character other_char_t>
1766 auto result = std::move(lhs);
1767 result += std::move(rhs);
1768 return result;
1769 }
1770
1775 template<xtd::character other_char_t>
1777 auto result = std::move(lhs);
1778 result += rhs;
1779 return result;
1780 }
1781
1786 template<xtd::character other_char_t>
1788 auto result = lhs;
1789 result += std::move(rhs);
1790 return result;
1791 }
1792
1797 template<xtd::character other_char_t>
1798 friend auto operator +(const basic_string& lhs, const std::basic_string<other_char_t>& rhs) -> basic_string {
1799 auto result = lhs;
1800 result += rhs;
1801 return result;
1802 }
1803
1808 template<xtd::character other_char_t>
1809 friend auto operator +(const std::basic_string<other_char_t>& lhs, const basic_string& rhs) -> basic_string {
1810 auto result = lhs;
1811 if constexpr(std::is_same_v<char, char_t>) result += rhs.chars();
1812 else result += __xtd_convert_to_string<char>(rhs.chars());
1813 return result;
1814 }
1815
1820 template<xtd::character other_char_t>
1821 friend auto operator +(const basic_string& lhs, const other_char_t* rhs) -> basic_string {
1822 auto result = lhs;
1823 result += rhs;
1824 return result;
1825 }
1826
1831 template<xtd::character other_char_t>
1832 friend auto operator +(basic_string&& lhs, const other_char_t* rhs) -> basic_string {
1833 auto result = std::move(lhs);
1834 result += rhs;
1835 return result;
1836 }
1837
1842 template<xtd::character other_char_t>
1843 friend auto operator +(const other_char_t* lhs, const basic_string& rhs) -> basic_string {
1844 auto result = basic_string(lhs);
1845 result += rhs;
1846 return result;
1847 }
1848
1853 template<xtd::character other_char_t>
1854 friend auto operator +(const other_char_t* lhs, basic_string&& rhs) -> basic_string {
1855 auto result = basic_string(lhs);
1856 result += std::move(rhs);
1857 return result;
1858 }
1859
1864 template<xtd::character other_char_t>
1865 friend auto operator +(const basic_string& lhs, other_char_t rhs) -> basic_string {
1866 auto result = lhs;
1867 result += rhs;
1868 return result;
1869 }
1870
1875 template<xtd::character other_char_t>
1876 friend auto operator +(basic_string&& lhs, other_char_t rhs) -> basic_string {
1877 auto result = std::move(lhs);
1878 result += rhs;
1879 return result;
1880 }
1881
1886 template<xtd::character other_char_t>
1887 friend auto operator +(other_char_t lhs, const basic_string& rhs) -> basic_string {
1888 auto result = basic_string(lhs, 1);
1889 result += rhs;
1890 return result;
1891 }
1892
1897 template<xtd::character other_char_t>
1898 friend auto operator +(other_char_t lhs, basic_string&& rhs) -> basic_string {
1899 auto result = basic_string(lhs, 1);
1900 result += std::move(rhs);
1901 return result;
1902 }
1903
1912 //friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string& str) {return stream << str.to_string().chars_;}
1913 friend auto operator <<(std::basic_ostream<char>& stream, const basic_string& str) -> std::basic_ostream<char>& {
1914 if constexpr(std::is_same_v<char, char_t>) return stream << str.chars();
1915 else return stream << __xtd_convert_to_string<char>(str.chars());
1916 }
1917
1923 friend auto operator <<(std::basic_ostream<xtd::wchar>& stream, const basic_string& str) -> std::basic_ostream<xtd::wchar>& {return stream << str.to_wstring().chars();}
1924
1933 friend auto operator >>(std::basic_istream<char>& stream, basic_string& str) -> std::basic_istream<char>& {
1934 auto s = std::basic_string<char> {};
1935 stream >> s;
1936 str = s;
1937 return stream;
1938 }
1939
1947 friend auto operator >>(std::basic_istream<xtd::wchar>& stream, basic_string& str) -> std::basic_istream<xtd::wchar>& {
1948 auto s = std::basic_string<xtd::wchar> {};
1949 stream >> s;
1950 str = s;
1951 return stream;
1952 }
1953
1954
1956
1960 [[deprecated("Replaced by xtd::basic_string::is_empty(const xtd::basic_string&) - Will be removed in version 1.2.0.")]]
1961 [[nodiscard]] auto is_empty() const noexcept -> bool {return is_empty(self_);}
1967
1969
1970 template<typename object_t>
1971 [[deprecated("Replaced by typeof_<object_t>().name() - Will be removed in version 1.2.0.")]]
1972 [[nodiscard]] static auto class_name() -> basic_string {return get_class_name(full_class_name<object_t>());}
1977 template<typename object_t>
1978 [[deprecated("Replaced by typeof_(object).name() - Will be removed in version 1.2.0.")]]
1979 [[nodiscard]] static auto class_name(const object_t& object) -> basic_string {return get_class_name(full_class_name(object));}
1984 [[deprecated("Replaced by typeof_(info).name() - Will be removed in version 1.2.0.")]]
1985 [[nodiscard]] static auto class_name(const std::type_info& info) -> basic_string {return __xtd_get_class_name(info);}
1990 template<typename object_t>
1991 [[deprecated("Replaced by typeof_<object_t>().full_name() - Will be removed in version 1.2.0.")]]
1992 [[nodiscard]] static auto full_class_name() -> basic_string {return demangle(typeid(object_t).name());}
1997 template<typename object_t>
1998 [[deprecated("Replaced by typeof_(object).full_name() - Will be removed in version 1.2.0.")]]
1999 [[nodiscard]] static auto full_class_name(const object_t& object) -> basic_string {return demangle(typeid(object).name());}
2004 [[deprecated("Replaced by typeof_(info).full_name() - Will be removed in version 1.2.0.")]]
2005 [[nodiscard]] static auto full_class_name(const std::type_info& info) -> basic_string {return __xtd_get_full_class_name(info);}
2007
2008 private:
2009 friend class basic_string<char>;
2010 friend class basic_string<xtd::char16>;
2011 friend class basic_string<xtd::char32>;
2012 friend class basic_string<xtd::char8>;
2013 friend class basic_string<xtd::wchar>;
2014
2015 static const xtd::array<value_type> default_split_separators;
2016 static const xtd::array<value_type> default_trim_chars;
2017
2018 template<typename arg_t>
2019 [[nodiscard]] static auto convert_param(arg_t&& arg) noexcept {
2020 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();
2021 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();
2022 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();
2023 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();
2024 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();
2025 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();
2026 else return std::forward<arg_t>(arg);
2027 }
2028
2029 [[nodiscard]] static auto get_class_name(const basic_string& full_name) -> basic_string {
2030 auto length = full_name.last_index_of("<");
2031 if (length == npos) length = full_name.length();
2032 if (full_name.last_index_of("::", 0, length) == npos) return full_name;
2033 return full_name.substring(full_name.last_index_of("::", 0, length) + 2);
2034 }
2035
2036 base_type chars_;
2037 };
2038}
2039
2040#define __XTD_BASIC_STRING_INTERNAL__
2041#include "basic_string_.hpp"
2042#undef __XTD_BASIC_STRING_INTERNAL__
2043
2045namespace std {
2046 template<typename char_t>
2047 struct hash<xtd::basic_string<char_t>> {
2048 auto operator()(const xtd::basic_string<char_t>& s) const noexcept -> xtd::usize {return s.get_hash_code();}
2049 };
2050}
Contains xtd::basic_read_only_string_view alias.
Contains xtd::basic_string class.
Contains xtd::basic_string_view alias.
Contains xtd::character concept.
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:74
basic_string(const basic_string< xtd::char32 > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:157
std::basic_string< char_t, traits_t, allocator_t > base_type
Represents the basic string base type.
Definition basic_string.hpp:81
auto remove(xtd::usize start_index, xtd::usize count) const -> basic_string
Deletes all the characters from this basic_string beginning at a specified position and continuing th...
Definition basic_string.hpp:683
static auto parse(const basic_string &str) -> value_t
Converts a basic_string into a value_t type.
Definition basic_string.hpp:1290
auto last_index_of(const basic_string &value) const noexcept -> xtd::usize
Reports the index of the last occurrence of the specified basic_string in this basic_string.
Definition basic_string.hpp:563
auto trim_end(value_type trim_char) const noexcept -> basic_string
Removes all trailing occurrences of a character specified from the specified xtd::basic_string .
auto substring(xtd::usize start_index) const -> basic_string
Retrieves a substring from this instance. The substring starts at a specified character position and ...
Definition basic_string.hpp:851
auto trim(const xtd::array< value_type > &trim_chars) const noexcept -> basic_string
Removes all leading and trailing occurrences of a set of characters specified in an array from the sp...
auto replace(const basic_string &old_string, const basic_string &new_string) const noexcept -> basic_string
Replaces all occurrences of a specified basic_string in this basic_string with another specified basi...
Definition basic_string.hpp:700
auto quoted(value_type delimiter, value_type escape) const -> basic_string
Allows insertion and extraction of quoted strings, such as the ones found in CSV or XML ith specified...
Definition basic_string.hpp:668
static auto concat(object_a_t obj_a, object_b_t obj_b) noexcept -> basic_string
Concatenates two specified instances of object.
Definition basic_string.hpp:1107
static auto class_name() -> basic_string
Gets the class name of the object_t.
Definition basic_string.hpp:1972
auto compare_to(const object &value) const -> xtd::int32
Compares this instance with a specified xtd::object and indicates whether this instance precedes,...
Definition basic_string.hpp:386
static auto compare(const basic_string &str_a, xtd::usize index_a, const basic_string &str_b, xtd::usize index_b, xtd::usize length) -> xtd::int32
Compares substrings of two specified basic_string objects and returns an integer that indicates their...
Definition basic_string.hpp:1039
auto to_u32string() const noexcept -> basic_string< xtd::char32 >
Converts the value of this instance to a xtd::basic_string <xtd::char32>.
Definition basic_string.hpp:916
static const basic_string empty_string
Definition basic_string.hpp:119
auto chars() noexcept -> base_type &
Returns a reference to the underlying base type.
Definition basic_string.hpp:343
auto operator=(const basic_string< char > &str) noexcept -> basic_string &
Copy assignment operator. Replaces the contents with a copy of the contents of str.
Definition basic_string.hpp:1417
static auto equals(const basic_string &a, const basic_string &b) noexcept -> bool
Determines whether two specified xtd::basic_string objects have the same value.
Definition basic_string.hpp:1185
auto to_array() const noexcept -> xtd::array< value_type >
Copies the characters in this instance to a Unicode character array.
friend auto operator<<(std::basic_ostream< char > &stream, const basic_string &str) -> std::basic_ostream< char > &
Output stream operator. Behaves as a FormattedOutputFunction. After constructing and checking the sen...
Definition basic_string.hpp:1913
basic_string(xtd::wchar character, xtd::usize count)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:222
basic_string(const xtd::char32 *str)
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:239
auto to_u16string() const noexcept -> basic_string< xtd::char16 >
Definition basic_string.hpp:909
typename base_type::allocator_type allocator_type
Represents the basic string allocator type.
Definition basic_string.hpp:87
auto index_of(value_type value) const noexcept -> xtd::usize
Reports the index of the first occurrence of the specified character in this basic_string.
Definition basic_string.hpp:506
basic_string(const xtd::wchar *str, xtd::usize count)
Initializes a new instance of xtd::basic_string with specified substring and count characters.
Definition basic_string.hpp:289
auto trim_start(const xtd::array< value_type > &trim_chars) const noexcept -> basic_string
Removes all leading occurrences of a set of characters specified in an array from the specified xtd::...
auto to_upper() const noexcept -> basic_string
Returns a copy of the current xtd::basic_string converted to uppercase.
Definition basic_string.hpp:930
static auto compare(const basic_string &str_a, const basic_string &str_b) noexcept -> xtd::int32
Compares two specified basic_string objects and returns an integer that indicates their relative posi...
Definition basic_string.hpp:1004
basic_string(const xtd::basic_string_view< char_t > &str)
Initializes a new instance of xtd::basic_string with specified xtd::basic_string_view.
Definition basic_string.hpp:304
static auto full_class_name() -> basic_string
Definition basic_string.hpp:1992
virtual auto contains(const basic_string &value) const noexcept -> bool
Returns a value indicating whether a specified substring occurs within this basic_string.
Definition basic_string.hpp:407
auto starts_with(const basic_string &value, bool ignore_case) const noexcept -> bool
Determines whether the beginning of this instance of xtd::basic_string matches a specified xtd::basic...
Definition basic_string.hpp:836
typename xtd::collections::generic::enumerator< value_type > enumerator_type
Represents the basic string enumerator type.
Definition basic_string.hpp:111
auto quoted(value_type delimiter) const -> basic_string
Allows insertion and extraction of quoted strings, such as the ones found in CSV or XML ith specified...
Definition basic_string.hpp:662
basic_string(const basic_string< xtd::char8 > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:163
static auto join(const basic_string &separator, const collection_t &values) noexcept -> basic_string
Concatenates a specified separator basic_string between each element of a specified object array,...
Definition basic_string.hpp:1241
static auto join(const basic_string &separator, const collection_t &values, xtd::usize index) -> basic_string
Concatenates a specified separator basic_string between each element of a specified object array,...
Definition basic_string.hpp:1256
auto trim_end(const xtd::array< value_type > &trim_chars) const noexcept -> basic_string
Removes all trailing occurrences of a set of characters specified in an array from the specified xtd:...
auto equals(const basic_string &value, bool ignore_case) const noexcept -> bool
Determines whether this instance and another specified xtd::basic_string object have the same value,...
Definition basic_string.hpp:423
auto compare_to(const basic_string &value) const noexcept -> xtd::int32 override
Compares this instance with a specified xtd::basic_string object and indicates whether this instance ...
Definition basic_string.hpp:398
basic_string(input_iterator_t first, input_iterator_t last)
Initializes a new instance of xtd::basic_string with specified first and last iterators of substring.
Definition basic_string.hpp:298
auto starts_with(const basic_string &value, xtd::string_comparison comparison_type) const noexcept -> bool
Determines whether the end of this basic_string matches the specified basic_string when compared usin...
Definition basic_string.hpp:841
auto last_index_of_any(const xtd::array< value_type > &values, xtd::usize start_index) const -> xtd::usize
Reports the index of the last occurrence in this instance of any character in a specified array of ch...
typename base_type::const_pointer const_pointer
Represents the basic string const pointer type.
Definition basic_string.hpp:99
basic_string(std::initializer_list< xtd::wchar > il)
Initializes a new instance of xtd::basic_string with specified initializer list.
Definition basic_string.hpp:322
friend auto operator>>(std::basic_istream< char > &stream, basic_string &str) -> std::basic_istream< char > &
Input stream operator. Behaves as a FormattedInputFunction. After constructing and checking the sentr...
Definition basic_string.hpp:1933
auto trim(value_type trim_char) const noexcept -> basic_string
Removes all leading and trailing occurrences of a character specified from the specified xtd::basic_s...
basic_string(const xtd::char32 *str, xtd::usize count)
Initializes a new instance of xtd::basic_string with specified substring and count characters.
Definition basic_string.hpp:275
auto operator[](xtd::usize index) const -> const_reference
Returns a reference to the character at specified location index.
Definition basic_string.hpp:1379
basic_string(const basic_string< xtd::char16 > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:151
auto substring(xtd::usize start_index, xtd::usize length) const -> basic_string
Retrieves a substring from this instance. The substring starts at a specified character position and ...
Definition basic_string.hpp:860
basic_string(const std::basic_string< char > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:175
virtual auto length() const noexcept -> size_type
Gets the number of characters in the current xtd::basic_string object.
Definition basic_string.hpp:366
typename base_type::traits_type traits_type
Represents the basic string traits type.
Definition basic_string.hpp:83
virtual auto get_base_type() const noexcept -> const base_type &
Returns the underlying base type.
Definition basic_string.hpp:460
static auto compare(const basic_string &str_a, xtd::usize index_a, const basic_string &str_b, xtd::usize index_b, xtd::usize length, xtd::string_comparison comparison_type) -> xtd::int32
Compares substrings of two specified basic_string objects using the specified rules,...
Definition basic_string.hpp:1067
typename base_type::pointer pointer
Represents the basic string pointer type.
Definition basic_string.hpp:97
typename base_type::const_reference const_reference
Represents the basic string const referecne type.
Definition basic_string.hpp:95
basic_string(std::initializer_list< xtd::char32 > il)
Initializes a new instance of xtd::basic_string with specified initializer list.
Definition basic_string.hpp:316
auto ends_with(const basic_string &value) const noexcept -> bool
Determines whether the end of this basic_string matches the specified basic_string.
Definition basic_string.hpp:443
basic_string(const std::basic_string< xtd::char16 > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:181
auto last_index_of_any(const xtd::array< value_type > &values, xtd::usize start_index, xtd::usize count) const -> xtd::usize
Reports the index of the last occurrence in this instance of any character in a specified array of ch...
auto to_u8string() const noexcept -> basic_string< xtd::char8 >
Converts the value of this instance to a xtd::basic_string <xtd::char8>.
Definition basic_string.hpp:923
virtual auto contains(value_type value) const noexcept -> bool
Returns a value indicating whether a specified char occurs within this basic_string.
Definition basic_string.hpp:403
static auto concat(object_a_t obj_a, object_b_t obj_b, object_c_t obj_c, object_d_t obj_d) noexcept -> basic_string
Concatenates four specified instances of object.
Definition basic_string.hpp:1083
auto pad_right(xtd::usize total_width) const noexcept -> basic_string
Left-aligns the characters in this basic_string, padding with spaces on the right for a specified tot...
Definition basic_string.hpp:644
static auto compare(const basic_string &str_a, xtd::usize index_a, const basic_string &str_b, xtd::usize index_b, xtd::usize length, bool ignore_case) -> xtd::int32
Compares substrings of two specified basic_string objects, ignoring or honoring their case,...
Definition basic_string.hpp:1053
auto to_lower() const noexcept -> basic_string
Returns a copy of the current xtd::basic_string converted to lowercase.
Definition basic_string.hpp:889
auto pad_right(xtd::usize total_width, char32 padding_char) const noexcept -> basic_string
Left-aligns the characters in this basic_string, padding with spaces on the right for a specified tot...
Definition basic_string.hpp:651
basic_string(const char *str, xtd::usize count)
Initializes a new instance of xtd::basic_string with specified substring and count characters.
Definition basic_string.hpp:261
basic_string(const basic_string< xtd::wchar > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:169
static auto concat(const xtd::array< basic_string > &values) noexcept -> basic_string
Concatenates the elements of a specified basic_string array.
basic_string(xtd::char8 character, xtd::usize count)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:218
static auto full_class_name(const object_t &object) -> basic_string
Gets the fully qualified class name of the specified object, including the namespace of the specified...
Definition basic_string.hpp:1999
static auto compare(const basic_string &str_a, const basic_string &str_b, xtd::string_comparison comparison_type) noexcept -> xtd::int32
Compares two specified basic_string objects using the specified rules, and returns an integer that in...
Definition basic_string.hpp:1026
auto index_of(value_type value, xtd::usize start_index) const -> xtd::usize
Reports the index of the first occurrence of the specified character in this basic_string....
Definition basic_string.hpp:511
typename xtd::collections::generic::ienumerable< char_t >::iterator iterator
Represents the basic string iterator type.
Definition basic_string.hpp:102
typename base_type::const_reverse_iterator const_reverse_iterator
Represents the basic string const reverse iterator type.
Definition basic_string.hpp:109
static auto concat(const basic_string &str_a, const basic_string &str_b, const basic_string &str_c, const basic_string &str_d) noexcept -> basic_string
Concatenates four specified instances of basic_string.
Definition basic_string.hpp:1075
auto index_of(const basic_string &value, xtd::usize start_index) const -> xtd::usize
Reports the index of the first occurrence of the specified character in this basic_string....
Definition basic_string.hpp:491
basic_string(const char *str)
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:225
auto last_index_of(value_type value) const noexcept -> xtd::usize
Reports the index of the last occurrence of the specified character in this tring.
Definition basic_string.hpp:584
auto to_wstring() const noexcept -> basic_string< xtd::wchar >
Converts the value of this instance to a xtd::basic_string <xtd::wchar>.
Definition basic_string.hpp:938
auto c_str() const noexcept -> const_pointer
Returns a pointer to a null-terminated character array with data equivalent to those stored in the st...
Definition basic_string.hpp:336
basic_string(const xtd::char16 *str, xtd::usize count)
Initializes a new instance of xtd::basic_string with specified substring and count characters.
Definition basic_string.hpp:268
basic_string(std::initializer_list< char > il)
Initializes a new instance of xtd::basic_string with specified xtd::basic_string_view.
Definition basic_string.hpp:310
auto to_title_case() const noexcept -> basic_string
Converts the current basic_string to title case (except for words that are entirely in uppercase,...
static auto concat(const basic_string &str_a, const basic_string &str_b, const basic_string &str_c) noexcept -> basic_string
Concatenates three specified instances of basic_string.
Definition basic_string.hpp:1089
static auto join(const basic_string &separator, const collection_t &values, xtd::usize index, xtd::usize count) -> basic_string
Concatenates a specified separator basic_string between each element of a specified Object array,...
Definition basic_string.hpp:1266
bool starts_with(value_type value, bool ignore_case) const noexcept
Determines whether the beginning of this instance of xtd::basic_string matches a specified xtd::basic...
Definition basic_string.hpp:822
typename base_type::size_type size_type
Represents the basic string size type.
Definition basic_string.hpp:89
auto last_index_of(const basic_string &value, xtd::usize start_index) const -> xtd::usize
Reports the index of the last occurrence of the specified character in this basic_string....
Definition basic_string.hpp:569
auto ends_with(const basic_string &value, bool ignore_case) const noexcept -> bool
Determines whether the end of this basic_string instance matches the specified basic_string,...
Definition basic_string.hpp:448
static auto try_parse(const basic_string &str, value_t &value) noexcept -> bool
Try to convert a basic_string into a value_t type.
Definition basic_string.hpp:1362
basic_string(const xtd::wchar *str)
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:253
auto replace(value_type old_char, value_type new_char) const noexcept -> basic_string
Replaces all occurrences of a specified char_t in this basic_string with another specified char_t.
Definition basic_string.hpp:694
auto trim_start() const noexcept -> basic_string
Removes all leading occurrences of white-space characters from the specified xtd::basic_string.
Definition basic_string.hpp:979
auto last_index_of(value_type value, xtd::usize start_index, xtd::usize count) const -> xtd::usize
Reports the index of the last occurrence of the specified character in this basic_string....
Definition basic_string.hpp:598
auto equals(const object &obj) const noexcept -> bool override
Determines whether this instance and a specified object, which must also be a xtd::basic_string objec...
Definition basic_string.hpp:412
basic_string(basic_string &&)=default
Initializes a new instance of xtd::basic_string with specified string to move.
static constexpr size_type npos
Definition basic_string.hpp:129
auto trim_start(value_type trim_char) const noexcept -> basic_string
Removes all leading occurrences of a character specified from the specified xtd::basic_string .
basic_string(xtd::char16 character, xtd::usize count)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:210
virtual auto empty() const noexcept -> bool
Checks whether the container is empty.
Definition basic_string.hpp:361
static auto equals(const char_a_t *a, const char_b_t *b, bool ignore_case) noexcept -> bool
Determines whether two specified xtd::basic_string objects have the same value, ignoring or honoring ...
Definition basic_string.hpp:1208
basic_string(xtd::char32 character, xtd::usize count)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:214
basic_string(const basic_string< char > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:145
static auto concat(const xtd::array< object_t > &args) noexcept -> basic_string
Concatenates the basic_string representations of the elements in a specified object array.
static auto full_class_name(const std::type_info &info) -> basic_string
Gets the fully qualified class name of the specified object, including the namespace of the specified...
Definition basic_string.hpp:2005
basic_string(const xtd::char8 *str, xtd::usize count)
Initializes a new instance of xtd::basic_string with specified substring and count characters.
Definition basic_string.hpp:282
static auto class_name(const std::type_info &info) -> basic_string
Gets the class name of the specified object.
Definition basic_string.hpp:1985
static auto concat(value_t value) noexcept -> basic_string
Creates the basic_string representation of a specified object.
Definition basic_string.hpp:1151
auto last_index_of(const basic_string &value, xtd::usize start_index, xtd::usize count) const -> xtd::usize
Reports the index of the last occurrence of the specified character in this basic_string....
Definition basic_string.hpp:576
auto trim() const noexcept -> basic_string
Removes all leading and trailing occurrences of white-space characters from the specified xtd::basic_...
Definition basic_string.hpp:947
auto ends_with(value_type value, bool ignore_case) const noexcept -> bool
Determines whether the end of this basic_string matches the specified character, ignoring or honoring...
Definition basic_string.hpp:436
auto insert(xtd::usize start_index, const basic_string &value) const -> basic_string
Inserts a specified instance of basic_string at a specified index position in this instance.
Definition basic_string.hpp:553
auto quoted() const -> basic_string
Allows insertion and extraction of quoted strings, such as the ones found in CSV or XML.
Definition basic_string.hpp:657
basic_string(const xtd::char16 *str)
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:232
typename base_type::value_type value_type
Represents the basic string value type.
Definition basic_string.hpp:85
typename base_type::reverse_iterator reverse_iterator
Represents the basic string reverse iterator type.
Definition basic_string.hpp:107
auto remove(xtd::usize start_index) const -> basic_string
Deletes all the characters from this basic_string beginning at a specified position and continuing th...
Definition basic_string.hpp:678
auto operator()(xtd::usize index) const -> const_reference
Returns a reference to the character at specified location index.
Definition basic_string.hpp:1397
auto ends_with(value_type value) const noexcept -> bool
Determines whether the end of this basic_string matches the specified character.
Definition basic_string.hpp:431
basic_string(std::initializer_list< xtd::char16 > il)
Initializes a new instance of xtd::basic_string with specified initializer list.
Definition basic_string.hpp:313
auto to_char_array() const noexcept -> xtd::array< value_type >
auto pad_left(xtd::usize total_width, char32 padding_char) const noexcept -> basic_string
Right-aligns the characters in this basic_string, padding with spaces on the left for a specified tot...
Definition basic_string.hpp:637
basic_string(std::initializer_list< xtd::char8 > il)
Initializes a new instance of xtd::basic_string with specified initializer list.
Definition basic_string.hpp:319
auto index_of_any(const xtd::array< value_type > &values, xtd::usize start_index, xtd::usize count) const -> xtd::usize
Reports the index of the first occurrence in this instance of any character in a specified array of c...
static auto demangle(const basic_string &name) -> basic_string
Gets demangled basic_string of name,.
Definition basic_string.hpp:1175
auto equals(const basic_string &value) const noexcept -> bool override
Determines whether this instance and another specified xtd::basic_string object have the same value.
Definition basic_string.hpp:417
auto trim_end() const noexcept -> basic_string
Removes all trailing occurrences of white-space characters from the specified xtd::basic_string.
Definition basic_string.hpp:963
basic_string()=default
Initializes a new instance of xtd::basic_string.
auto index_of_any(const xtd::array< value_type > &values, xtd::usize start_index) const -> xtd::usize
Reports the index of the first occurrence in this instance of any character in a specified array of c...
bool starts_with(value_type value) const noexcept
Definition basic_string.hpp:816
static auto concat(object_a_t obj_a, object_b_t obj_b, object_c_t obj_c) noexcept -> basic_string
Concatenates three specified instances of object.
Definition basic_string.hpp:1096
static auto compare(const basic_string &str_a, const basic_string &str_b, bool ignore_case) noexcept -> xtd::int32
Compares two specified basic_string objects, ignoring or honoring their case, and returns an integer ...
Definition basic_string.hpp:1015
basic_string(const xtd::char8 *str)
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:246
auto index_of_any(const xtd::array< value_type > &values) const noexcept -> xtd::usize
Reports the index of the first occurrence in this instance of any character in a specified array of c...
static auto concat(const basic_string &str_a, const basic_string &str_b) noexcept -> basic_string
Concatenates two specified instances of basic_string.
Definition basic_string.hpp:1101
auto last_index_of(value_type value, xtd::usize start_index) const -> xtd::usize
Reports the index of the last occurrence of the specified character in this basic_string....
Definition basic_string.hpp:590
auto is_empty() const noexcept -> bool
Name Public Deprecated Methods.
Definition basic_string.hpp:1961
auto data() const noexcept -> const_pointer
Returns a pointer to the underlying array serving as character storage. The pointer is such that the ...
Definition basic_string.hpp:357
auto index_of(value_type value, xtd::usize start_index, xtd::usize count) const -> xtd::usize
Reports the index of the first occurrence of the specified character in this basic_string....
Definition basic_string.hpp:518
auto starts_with(const basic_string &value) const noexcept -> bool
Determines whether the beginning of this instance of xtd::basic_string matches a specified xtd::basic...
Definition basic_string.hpp:830
auto split() const noexcept -> xtd::array< basic_string >
Splits this basic_string into substrings that are based on the default white-space characters....
auto get_hash_code() const noexcept -> xtd::usize override
Returns the hash code for this basic_string.
Definition basic_string.hpp:464
auto to_string() const noexcept -> basic_string< char > override
Converts the value of this instance to a xtd::basic_string <char>.
Definition basic_string.hpp:898
auto get_enumerator() const noexcept -> enumerator_type override
Returns an enumerator that iterates through a collection.
Definition basic_string.hpp:466
typename base_type::reference reference
Represents the basic string referecne type.
Definition basic_string.hpp:93
static auto equals(const char_a_t *a, const char_b_t *b) noexcept -> bool
Determines whether two specified xtd::basic_string objects have the same value.
Definition basic_string.hpp:1192
basic_string(const std::basic_string< xtd::wchar > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:199
virtual auto count() const noexcept -> size_type
Definition basic_string.hpp:348
basic_string(char character, xtd::usize count)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:206
auto ends_with(const basic_string &value, xtd::string_comparison comparison_type) const noexcept -> bool
Determines whether the end of this basic_string matches the specified basic_string when compared usin...
Definition basic_string.hpp:453
static auto equals(const basic_string &a, const basic_string &b, bool ignore_case) noexcept -> bool
Determines whether two specified xtd::basic_string objects have the same value, ignoring or honoring ...
Definition basic_string.hpp:1200
typename xtd::collections::generic::ienumerable< char_t >::const_iterator const_iterator
Represents the basic string const iterator type.
Definition basic_string.hpp:105
typename base_type::difference_type difference_type
Represents the basic string difference type.
Definition basic_string.hpp:91
auto pad_left(xtd::usize total_width) const noexcept -> basic_string
Right-aligns the characters in this basic_string, padding with spaces on the left for a specified tot...
Definition basic_string.hpp:630
basic_string(const std::basic_string< xtd::char32 > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:187
auto operator+=(const basic_string< other_char_t > &str) -> basic_string &
Addition assignment operator. Appends additional characters to the string.
Definition basic_string.hpp:1705
auto last_index_of_any(const xtd::array< value_type > &values) const noexcept -> xtd::usize
Reports the index of the last occurrence in this instance of any character in a specified array of ch...
basic_string(const std::basic_string< xtd::char8 > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:193
friend auto operator+(const basic_string &lhs, const basic_string< other_char_t > &rhs) -> basic_string
Addition operator. Returns a string containing characters from lhs followed by the characters from rh...
Definition basic_string.hpp:1754
auto chars() const noexcept -> const base_type &
Returns a reference to the underlying base type.
Definition basic_string.hpp:340
basic_string(const xtd::collections::generic::ienumerable< char_t > &items)
Initializes a new instance of xtd::basic_string with specified ienumerable.
Definition basic_string.hpp:301
static auto is_empty(const xtd::basic_string< value_type, traits_type, allocator_type > &string) noexcept -> bool
Indicates whether the specifeid basic_string is an empty basic_string ("").
Definition basic_string.hpp:1232
basic_string(std::basic_string< char_t > &&str)
Initializes a new instance of xtd::basic_string with specified string to move.
Definition basic_string.hpp:142
static auto class_name(const object_t &object) -> basic_string
Gets the class name of the specified object.
Definition basic_string.hpp:1979
auto index_of(const basic_string &value) const noexcept -> xtd::usize
Reports the index of the first occurrence of the specified basic_string in this basic_string.
Definition basic_string.hpp:486
virtual auto size() const noexcept -> size_type
Gets the number of characters in the current xtd::basic_string object.
Definition basic_string.hpp:371
auto index_of(const basic_string &value, xtd::usize start_index, xtd::usize count) const -> xtd::usize
Reports the index of the first occurrence of the specified character in this basic_string....
Definition basic_string.hpp:498
Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Definition ienumerable.hpp:40
typename xtd::collections::generic::extensions::enumerable_iterators< xtd::any_object, xtd::collections::generic::ienumerable< xtd::any_object > >::const_iterator const_iterator
Definition ienumerable.hpp:50
typename xtd::collections::generic::extensions::enumerable_iterators< xtd::any_object, xtd::collections::generic::ienumerable< xtd::any_object > >::iterator iterator
Definition ienumerable.hpp:48
Supports a simple iteration over a generic collection.
Definition ienumerator.hpp:58
static auto combine(args_t... values) noexcept -> xtd::usize
Combines values into a hash code.
Definition hash_code.hpp:70
static auto throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current()) -> void
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:22
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
object()=default
Create a new instance of the ultimate base class object.
Represents a range that has start and end indexes.
Definition range.hpp:38
Definition character.hpp:17
Contains xtd::collections::generic::ienumerable <type_t> interface.
static auto sprintf(const basic_string &fmt, args_t &&... args) noexcept -> basic_string
Writes the text representation of the specified arguments list, to basic_string using the specified f...
Definition basic_string.hpp:1355
static auto format(const basic_string< char > &fmt, args_t &&... args) -> basic_string
Writes the text representation of the specified arguments list, to string using the specified format ...
static auto format(const std::locale &loc, const basic_string< char > &fmt, args_t &&... args) -> basic_string
Writes the text representation of the specified arguments list, to string using the specified format ...
@ 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
std::basic_string_view< char_t, traits_t > basic_string_view
Represents an object that can refer to a constant contiguous sequence of char_t with the first elemen...
Definition basic_string_view.hpp:16
std::basic_string_view< char_t, traits_t > basic_read_only_string_view
Represents an object that can refer to a constant contiguous sequence of char_t with the first elemen...
Definition basic_read_only_string_view.hpp:16
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:25
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
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
auto parse(const std::string &str) -> value_t
Convert a string into a type.
Definition parse.hpp:34
auto new_ptr(args_t &&... args) -> xtd::ptr< type_t >
The xtd::new_ptr operator creates a xtd::ptr object.
Definition new_ptr.hpp:24
@ 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
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
auto first() const -> read_only_span< type_t, count >
Obtains a subspan consisting of the first count elements of the sequence.
Definition read_only_span.hpp:245
auto last() const -> read_only_span< type_t, count >
Obtains a subspan consisting of the last N elements of the sequence.
Definition read_only_span.hpp:286
auto operator()(size_type index) const -> const_reference
Gets the element at the specified zero-based index.
Definition read_only_span.hpp:401
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:39
Represents a type that can be used to index a collection either from the beginning or the end.
Definition index.hpp:38
Contains xtd fundamental types.