xtd 0.2.0
Loading...
Searching...
No Matches
basic_string.hpp
Go to the documentation of this file.
1
4#pragma once
6#define __XTD_CORE_INTERNAL__
11#undef __XTD_CORE_INTERNAL__
12#define __XTD_STD_INTERNAL__
14#undef __XTD_STD_INTERNAL__
17#include "hash_code.hpp"
18#include "icomparable.hpp"
19#include "iequatable.hpp"
20#include "null.hpp"
21#include "string_comparison.hpp"
23#include "types.hpp"
24#include "object.hpp"
25#include "parse.hpp"
26#include "to_string.hpp"
27#include "types.hpp"
28#include "unused.hpp"
29#include <cctype>
30#if defined(__xtd__cpp_lib_format)
31#include <format>
32#endif
33#include <iomanip>
34#include <ostream>
35#include <sstream>
36#include <string>
37
39template<typename ...args_t>
40void __basic_string_extract_format_arg(xtd::basic_string<char>& fmt, xtd::array<__format_information<char>>& formats, args_t&&... args);
41template<typename target_t, typename source_t>
42std::basic_string<target_t> __xtd_convert_to_string(std::basic_string<source_t>&& str) noexcept;
43template<typename target_t, typename source_t>
44std::basic_string<target_t> __xtd_convert_to_string(const std::basic_string<source_t>& str) noexcept;
45std::basic_string<char> __xtd_demangle(const std::basic_string<char>& value) noexcept;
46std::basic_string<char> __xtd_get_class_name(const std::type_info& value) noexcept;
47std::basic_string<char> __xtd_get_full_class_name(const std::type_info& value) noexcept;
48void __throw_basic_string_argument_exception(const char* file, xtd::uint32 line, const char* func);
49void __throw_basic_string_argument_out_of_range_exception(const char* file, xtd::uint32 line, const char* func);
50void __throw_basic_string_format_exception(const char* file, xtd::uint32 line, const char* func);
51void __throw_basic_string_format_exception_close_bracket(const char* file, xtd::uint32 line, const char* func);
52void __throw_basic_string_format_exception_open_bracket(const char* file, xtd::uint32 line, const char* func);
53void __throw_basic_string_format_exception_start_colon(const char* file, xtd::uint32 line, const char* func);
54void __throw_basic_string_index_out_of_range_exception(const char* file, xtd::uint32 line, const char* func);
55void __throw_basic_string_null_pointer_exception(const char* file, xtd::uint32 line, const char* func);
57
59namespace xtd {
78 template<typename char_t, typename traits_t, typename allocator_t>
79 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> {
80 public:
82
86 using base_type = std::basic_string<char_t, traits_t, allocator_t>;
88 using traits_type = typename base_type::traits_type;
90 using value_type = typename base_type::value_type;
92 using allocator_type = typename base_type::allocator_type;
94 using size_type = typename base_type::size_type;
96 using difference_type = typename base_type::difference_type;
98 using reference = typename base_type::reference;
100 using const_reference = typename base_type::const_reference;
102 using pointer = typename base_type::pointer;
104 using const_pointer = typename base_type::const_pointer;
112 using reverse_iterator = typename base_type::reverse_iterator;
114 using const_reverse_iterator = typename base_type::const_reverse_iterator;
118
120
125
127 inline static constexpr size_type npos = base_type::npos;
129
131
134 basic_string() = default;
137 explicit basic_string(const allocator_type& allocator) noexcept;
138
141 basic_string(const basic_string<char>& str) noexcept {
142 if constexpr (std::is_same_v<char, char_t>) chars_ = str.chars_;
143 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
144 }
145
149 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = str.chars_;
150 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
151 }
155 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = str.chars_;
156 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
157 }
158#if defined(__xtd__cpp_lib_char8_t)
162 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = str.chars_;
163 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
164 }
165#endif
169 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = str.chars_;
170 else chars_ = __xtd_convert_to_string<value_type>(str.chars_);
171 }
172
176 basic_string(const basic_string<char>& str, const allocator_type& allocator) noexcept {
177 if constexpr (std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, allocator);
178 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
179 }
183 basic_string(const basic_string<xtd::char16>& str, const allocator_type& allocator) noexcept {
184 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, allocator);
185 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
186 }
190 basic_string(const basic_string<xtd::char32>& str, const allocator_type& allocator) noexcept {
191 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, allocator);
192 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
193 }
194#if defined(__xtd__cpp_lib_char8_t)
198 basic_string(const basic_string<xtd::char8>& str, const allocator_type& allocator) noexcept {
199 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, allocator);
200 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
201 }
202#endif
206 basic_string(const basic_string<xtd::wchar>& str, const allocator_type& allocator) noexcept {
207 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, allocator);
208 else chars_ = base_type(__xtd_convert_to_string<value_type>(str.chars_), allocator);
209 }
210
216 if (index > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
217 if constexpr (std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index);
218 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index)));
219 }
225 if (index > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
226 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index);
227 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index)));
228 }
234 if (index > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
235 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index);
236 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index)));
237 }
238#if defined(__xtd__cpp_lib_char8_t)
244 if (index > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
245 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index);
246 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index)));
247 }
248#endif
254 if (index > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
255 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index);
256 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index)));
257 }
258
264 basic_string(const basic_string<char>& str, xtd::size index, const allocator_type& allocator) {
265 if (index > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
266 if constexpr (std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index, allocator);
267 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index)), allocator);
268 }
274 basic_string(const basic_string<xtd::char16>& str, xtd::size index, const allocator_type& allocator) {
275 if (index > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
276 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index, allocator);
277 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index)), allocator);
278 }
284 basic_string(const basic_string<xtd::char32>& str, xtd::size index, const allocator_type& allocator) {
285 if (index > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
286 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index, allocator);
287 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index)), allocator);
288 }
289#if defined(__xtd__cpp_lib_char8_t)
295 basic_string(const basic_string<xtd::char8>& str, xtd::size index, const allocator_type& allocator) {
296 if (index > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
297 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index, allocator);
298 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index)), allocator);
299 }
300#endif
306 basic_string(const basic_string<xtd::wchar>& str, xtd::size index, const allocator_type& allocator) {
307 if (index > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
308 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index, allocator);
309 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index)), allocator);
310 }
311
318 if (index + count > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
319 if constexpr (std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index, count);
320 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index, count)));
321 }
328 if (index + count > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
329 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index, count);
330 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index, count)));
331 }
338 if (index + count > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
339 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index, count);
340 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index, count)));
341 }
342#if defined(__xtd__cpp_lib_char8_t)
349 if (index + count > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
350 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index, count);
351 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index, count)));
352 }
353#endif
360 if (index + count > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
361 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str.chars_, index, count);
362 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str.chars_, index, count)));
363 }
364
372 if (index + count > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
373 if constexpr (std::is_same_v<char, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
374 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<char>(str.chars_, index, count)), allocator);
375 }
383 if (index + count > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
384 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
385 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str.chars_, index, count)), allocator);
386 }
394 if (index + count > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
395 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
396 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str.chars_, index, count)), allocator);
397 }
398#if defined(__xtd__cpp_lib_char8_t)
406 if (index + count > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
407 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str.chars_, index, count, allocator);
408 else chars_ = base_type(__xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str.chars_, index, count)), allocator);
409 }
410#endif
418 if (index + count > str.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
419 if constexpr (std::is_same_v<xtd::wchar, 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::wchar>(str.chars_, index, count)), allocator);
421 }
422
426
430 basic_string(basic_string&& str, const allocator_type& allocator) noexcept : chars_(std::move(str.chars_)) {}
431
436 basic_string(xtd::size count, char character) : basic_string(std::basic_string<char>(count, character)) {}
441 basic_string(xtd::size count, char character, const allocator_type& allocator) : basic_string(std::basic_string<char>(count, character), allocator) {}
450 basic_string(xtd::size count, xtd::char16 character, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char16>(count, character), allocator) {}
459 basic_string(xtd::size count, xtd::char32 character, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char32>(count, character), allocator) {}
460#if defined(__xtd__cpp_lib_char8_t)
469 basic_string(xtd::size count, xtd::char8 character, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char8>(count, character), allocator) {}
470#endif
480 basic_string(xtd::size count, xtd::wchar character, const allocator_type& allocator) : basic_string(std::basic_string<xtd::wchar>(count, character), allocator) {}
481
485 basic_string(char character, xtd::size count) : basic_string(std::basic_string<char>(count, character)) {}
490 basic_string(char character, xtd::size count, const allocator_type& allocator) : basic_string(std::basic_string<char>(count, character), allocator) {}
499 basic_string(xtd::char16 character, xtd::size count, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char16>(count, character), allocator) {}
508 basic_string(xtd::char32 character, xtd::size count, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char32>(count, character), allocator) {}
509#if defined(__xtd__cpp_lib_char8_t)
518 basic_string(xtd::char8 character, xtd::size count, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char8>(count, character), allocator) {}
519#endif
528 basic_string(xtd::wchar character, xtd::size count, const allocator_type& allocator) : basic_string(std::basic_string<xtd::wchar>(count, character), allocator) {}
529
532 basic_string(const char* str) { // Can't be explicit by design.
533 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
534 if constexpr (std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str);
535 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str));
536 }
539 basic_string(const xtd::char16* str) { // Can't be explicit by design.
540 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
541 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str);
542 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str));
543 }
546 basic_string(const xtd::char32* str) { // Can't be explicit by design.
547 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
548 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str);
549 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str));
550 }
551#if defined(__xtd__cpp_lib_char8_t)
554 basic_string(const xtd::char8* str) { // Can't be explicit by design.
555 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
556 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str);
557 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str));
558 }
559#endif
562 basic_string(const xtd::wchar* str) { // Can't be explicit by design.
563 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
564 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
565 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
566 }
567
571 basic_string(const char* str, const allocator_type& allocator) {
572 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
573 if constexpr (std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str, allocator);
574 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str), allocator);
575 }
579 basic_string(const xtd::char16* str, const allocator_type& allocator) {
580 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
581 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str, allocator);
582 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str), allocator);
583 }
587 basic_string(const xtd::char32* str, const allocator_type& allocator) {
588 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
589 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str, allocator);
590 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str), allocator);
591 }
592#if defined(__xtd__cpp_lib_char8_t)
596 basic_string(const xtd::char8* str, const allocator_type& allocator) {
597 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
598 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str, allocator);
599 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str), allocator);
600 }
601#endif
605 basic_string(const xtd::wchar* str, const allocator_type& allocator) : chars_(allocator) {
606 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
607 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
608 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
609 }
610
613 basic_string(const char* str, xtd::size count) {
614 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
615 if constexpr (std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str, count);
616 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str, count));
617 }
621 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
622 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str, count);
623 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str, count));
624 }
628 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
629 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str, count);
630 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str, count));
631 }
632#if defined(__xtd__cpp_lib_char8_t)
636 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
637 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str, count);
638 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str, count));
639 }
640#endif
644 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
645 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str, count);
646 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str, count));
647 }
648
653 basic_string(const char* str, xtd::size count, const allocator_type& allocator) {
654 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
655 if constexpr (std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str, count, allocator);
656 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str, count), allocator);
657 }
662 basic_string(const xtd::char16* str, xtd::size count, const allocator_type& allocator) : chars_(allocator) {
663 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
664 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str, count, allocator);
665 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str, count), allocator);
666 }
671 basic_string(const xtd::char32* str, xtd::size count, const allocator_type& allocator) : chars_(allocator) {
672 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
673 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str, count, allocator);
674 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str, count), allocator);
675 }
676#if defined(__xtd__cpp_lib_char8_t)
681 basic_string(const xtd::char8* str, xtd::size count, const allocator_type& allocator) : chars_(allocator) {
682 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
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 }
686#endif
691 basic_string(const xtd::wchar* str, xtd::size count, const allocator_type& allocator) : chars_(allocator) {
692 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
693 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str, count, allocator);
694 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str, count), allocator);
695 }
696
699 basic_string(const std::basic_string<char>& str) noexcept { // Can't be explicit by design.
700 if constexpr (std::is_same_v<char, char_t>) chars_ = str;
701 else chars_ = __xtd_convert_to_string<value_type>(str);
702 }
705 basic_string(const std::basic_string<xtd::char16>& str) noexcept { // Can't be explicit by design.
706 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = str;
707 else chars_ = __xtd_convert_to_string<value_type>(str);
708 }
711 basic_string(const std::basic_string<xtd::char32>& str) noexcept { // Can't be explicit by design.
712 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = str;
713 else chars_ = __xtd_convert_to_string<value_type>(str);
714 }
715#if defined(__xtd__cpp_lib_char8_t)
718 basic_string(const std::basic_string<xtd::char8>& str) noexcept { // Can't be explicit by design.
719 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = str;
720 else chars_ = __xtd_convert_to_string<value_type>(str);
721 }
722#endif
725 basic_string(const std::basic_string<xtd::wchar>& str) noexcept { // Can't be explicit by design.
726 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = str;
727 else chars_ = __xtd_convert_to_string<value_type>(str);
728 }
729
733 basic_string(const std::basic_string<char>& str, const allocator_type& allocator) noexcept {
734 if constexpr (std::is_same_v<char, char_t>) chars_ = base_type(str, allocator);
735 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
736 }
740 basic_string(const std::basic_string<xtd::char16>& str, const allocator_type& allocator) noexcept {
741 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = base_type(str, allocator);
742 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
743 }
747 basic_string(const std::basic_string<xtd::char32>& str, const allocator_type& allocator) noexcept {
748 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = base_type(str, allocator);
749 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
750 }
751#if defined(__xtd__cpp_lib_char8_t)
755 basic_string(const std::basic_string<xtd::char8>& str, const allocator_type& allocator) noexcept {
756 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = base_type(str, allocator);
757 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
758 }
759#endif
763 basic_string(const std::basic_string<xtd::wchar>& str, const allocator_type& allocator) noexcept {
764 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = base_type(str, allocator);
765 else chars_ = base_type(__xtd_convert_to_string<value_type>(str), allocator);
766 }
767
771 template<typename input_iterator_t>
772 basic_string(input_iterator_t first, input_iterator_t last) : chars_(first, last) {}
777 template<typename input_iterator_t>
778 basic_string(input_iterator_t first, input_iterator_t last, const allocator_type& allocator) : chars_(first, last, allocator) {}
779
783 template<typename string_view_like_t>
784 explicit constexpr basic_string(const string_view_like_t& string_view) : chars_(string_view) {}
788 template<typename string_view_like_t>
789 explicit constexpr basic_string(const string_view_like_t& string_view, const allocator_type& allocator) : chars_(string_view, allocator) {}
795 template<typename string_view_like_t>
796 constexpr basic_string(const string_view_like_t& string_view, size_type index, size_type count) : chars_(string_view, index, count) {}
802 template<typename string_view_like_t>
803 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) {}
804
807 basic_string(std::initializer_list<char> il) : basic_string(std::basic_string<char>(il)) {}
810 basic_string(std::initializer_list<xtd::char16> il) : basic_string(std::basic_string<xtd::char16>(il)) {}
813 basic_string(std::initializer_list<xtd::char32> il) : basic_string(std::basic_string<xtd::char32>(il)) {}
814#if defined(__xtd__cpp_lib_char8_t)
817 basic_string(std::initializer_list<xtd::char8> il) : basic_string(std::basic_string<xtd::char8>(il)) {}
818#endif
821 basic_string(std::initializer_list<xtd::wchar> il) : basic_string(std::basic_string<xtd::wchar>(il)) {}
822
826 basic_string(std::initializer_list<char> il, const allocator_type& allocator) : basic_string(std::basic_string<char>(il), allocator) {}
830 basic_string(std::initializer_list<xtd::char16> il, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char16>(il), allocator) {}
834 basic_string(std::initializer_list<xtd::char32> il, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char32>(il), allocator) {}
835#if defined(__xtd__cpp_lib_char8_t)
839 basic_string(std::initializer_list<xtd::char8> il, const allocator_type& allocator) : basic_string(std::basic_string<xtd::char8>(il), allocator) {}
840#endif
844 basic_string(std::initializer_list<xtd::wchar> il, const allocator_type& allocator) : basic_string(std::basic_string<xtd::wchar>(il), allocator) {}
846
848
853 const_reference back() const {return operator[](size() - 1);}
854
858
867 const_pointer c_str() const noexcept {return chars_.c_str();}
868
871 size_type capacity() const noexcept {return chars_.capacity();}
872
876
879 const_reverse_iterator crbegin() const {return chars_.crbegin();}
880
883 const base_type& chars() const noexcept {return chars_;}
884
888
891 const_reverse_iterator crend() const {return chars_.crend();}
892
900 const_pointer data() const noexcept {return chars_.data();}
901
904 bool empty() const noexcept {return chars_.empty();}
905
909
913 const_reference front() const {return operator[](0);}
914
918 size_type length() const noexcept {return chars_.size();}
919
922 size_type max_size() const noexcept {return chars_.max_size();}
923
926 const_reverse_iterator rbegin() const {return chars_.crbegin();}
927
930 const_reverse_iterator rend() const {return chars_.crend();}
931
934 size_type size() const noexcept {return chars_.size();}
936
938
943 const_reference at(size_type pos) const {return operator [](pos);}
944
963 int32 compare(const basic_string& str) const {return chars_.compare(str);}
985 int32 compare(size_type pos1, size_type count1, const basic_string& str) const {return chars_.compare(pos1, count1, str);}
1009 int32 compare(size_type pos1, size_type count1, const basic_string& str, size_type pos2) const {return chars_.compare(pos1, count1, str, pos2);}
1034 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);}
1053 int32 compare(const_pointer s) const {return chars_.compare(s);}
1075 int32 compare(size_type pos1, size_type count1, const_pointer s) const {return chars_.compare(pos1, count1, s);}
1098 int32 compare(size_type pos1, size_type count1, const_pointer s, size_type count2) const {return chars_.compare(pos1, count1, s, count2);}
1099
1109 int32 compare_to(const object& value) const {
1110 if (!dynamic_cast<const basic_string*>(&value)) __throw_basic_string_argument_exception(__FILE__, __LINE__, __func__);
1111 return compare_to(static_cast<const basic_string&>(value));
1112 }
1121 int32 compare_to(const basic_string& value) const noexcept override {return chars_.compare(value.chars_);}
1122
1126 virtual bool contains(value_type value) const noexcept {return find(value) != npos;}
1130 virtual bool contains(const basic_string& value) const noexcept {return find(value) != npos;}
1131
1135 bool equals(const object& obj) const noexcept override {return dynamic_cast<const basic_string*>(&obj) && equals(static_cast<const basic_string&>(obj));}
1140 bool equals(const basic_string& value) const noexcept override {return equals(value, false);}
1146 bool equals(const basic_string& value, bool ignore_case) const noexcept {
1147 if (ignore_case) return to_upper().chars_ == value.to_upper().chars_;
1148 return chars_ == value.chars_;
1149 }
1150
1154 bool ends_with(value_type value) const noexcept {return ends_with(value, false);}
1159 bool ends_with(value_type value, bool ignore_case) const noexcept {
1160 if (ignore_case) return to_lower().rfind(static_cast<value_type>(tolower(value))) == size() - 1;
1161 return rfind(value) == size() - 1;
1162 }
1166 bool ends_with(const basic_string& value) const noexcept {return ends_with(value, xtd::string_comparison::ordinal);}
1171 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);}
1176 bool ends_with(const basic_string& value, xtd::string_comparison comparison_type) const noexcept {
1177 if (comparison_type == xtd::string_comparison::ordinal_ignore_case) return to_lower().rfind(value.to_lower()) + value.to_lower().size() == size();
1178 return rfind(value) + value.size() == size();
1179 }
1180
1184 size_type find(const basic_string& str) const {return chars_.find(str);}
1190 size_type find(const basic_string& str, size_type pos) const {return chars_.find(str, pos);}
1198 size_type find(const_pointer s, size_type pos, size_type count) const {return chars_.find(s, pos, count);}
1204 size_type find(const_pointer s) const {return chars_.find(s);}
1211 size_type find(const_pointer s, size_type pos) const {return chars_.find(s, pos);}
1216 size_type find(value_type ch) const {return chars_.find(ch);}
1222 size_type find(value_type ch, size_type pos) const {return chars_.find(ch, pos);}
1223
1228 size_type find_first_of(const basic_string& str) const {return chars_.find_first_of(str);}
1234 size_type find_first_of(const basic_string& str, size_type pos) const {return chars_.find_first_of(str, pos);}
1242 size_type find_first_of(const_pointer s, size_type pos, size_type count) const {return chars_.find_first_of(s, pos, count);}
1248 size_type find_first_of(const_pointer s) const {return chars_.find_first_of(s);}
1255 size_type find_first_of(const_pointer s, size_type pos) const {return chars_.find_first_of(s, pos);}
1260 size_type find_first_of(char_t ch) const {return chars_.find_first_of(ch);}
1266 size_type find_first_of(char_t ch, size_type pos) const {return chars_.find_first_of(ch, pos);}
1267
1272 size_type find_first_not_of(const basic_string& str) const {return chars_.find_first_not_of(str);}
1278 size_type find_first_not_of(const basic_string& str, size_type pos) const {return chars_.find_first_not_of(str, pos);}
1286 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);}
1292 size_type find_first_not_of(const_pointer s) const {return chars_.find_first_not_of(s);}
1299 size_type find_first_not_of(const_pointer s, size_type pos) const {return chars_.find_first_not_of(s, pos);}
1304 size_type find_first_not_of(char_t ch) const {return chars_.find_first_not_of(ch);}
1310 size_type find_first_not_of(char_t ch, size_type pos) const {return chars_.find_first_not_of(ch, pos);}
1311
1316 size_type find_last_of(const basic_string& str) const {return chars_.find_last_of(str);}
1322 size_type find_last_of(const basic_string& str, size_type pos) const {return chars_.find_last_of(str, pos);}
1330 size_type find_last_of(const_pointer s, size_type pos, size_type count) const {return chars_.find_last_of(s, pos, count);}
1336 size_type find_last_of(const_pointer s) const {return chars_.find_last_of(s);}
1343 size_type find_last_of(const_pointer s, size_type pos) const {return chars_.find_last_of(s, pos);}
1348 size_type find_last_of(char_t ch) const {return chars_.find_last_of(ch);}
1354 size_type find_last_of(char_t ch, size_type pos) const {return chars_.find_last_of(ch, pos);}
1355
1360 size_type find_last_not_of(const basic_string& str) const {return chars_.find_last_not_of(str);}
1366 size_type find_last_not_of(const basic_string& str, size_type pos) const {return chars_.find_last_not_of(str, pos);}
1374 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);}
1380 size_type find_last_not_of(const_pointer s) const {return chars_.find_last_not_of(s);}
1387 size_type find_last_not_of(const_pointer s, size_type pos) const {return chars_.find_last_not_of(s, pos);}
1392 size_type find_last_not_of(char_t ch) const {return chars_.find_last_not_of(ch);}
1398 size_type find_last_not_of(char_t ch, size_type pos) const {return chars_.find_last_not_of(ch, pos);}
1399
1402 allocator_type get_allocator() const {return chars_.get_allocator();}
1403
1406 virtual const base_type& get_base_type() const noexcept {return chars_;}
1407
1410 xtd::size get_hash_code() const noexcept override {return xtd::hash_code::combine(chars_);}
1411
1412 enumerator_type get_enumerator() const noexcept override {
1413 class basic_string_enumerator : public xtd::collections::generic::ienumerator<value_type> {
1414 public:
1415 explicit basic_string_enumerator(const basic_string& chars) : chars_(chars) {}
1416
1417 const value_type& current() const override {return chars_[index_];}
1418
1419 bool move_next() override {return ++index_ < chars_.size();}
1420
1421 void reset() override {index_ = basic_string::npos;}
1422
1423 protected:
1424 const basic_string& chars_;
1425 xtd::size index_ = basic_string::npos;
1426 };
1427 return {new_ptr<basic_string_enumerator>(*this)};
1428 }
1429
1433 xtd::size index_of(const basic_string& value) const noexcept {return index_of(value, 0, size());}
1438 xtd::size index_of(const basic_string& value, xtd::size start_index) const {return index_of(value, start_index, size() - start_index);}
1445 xtd::size index_of(const basic_string& value, xtd::size start_index, xtd::size count) const {
1446 if (start_index > size() || start_index + count > size()) __throw_basic_string_index_out_of_range_exception(__FILE__, __LINE__, __func__);
1447 auto result = find(value, start_index);
1448 return result > start_index + count ? npos : result;
1449 }
1453 xtd::size index_of(value_type value) const noexcept {return index_of(value, 0, size());}
1458 xtd::size index_of(value_type value, xtd::size start_index) const {return index_of(value, start_index, size() - start_index);}
1466 if (start_index > size() || start_index + count > size()) __throw_basic_string_index_out_of_range_exception(__FILE__, __LINE__, __func__);
1467 auto result = find(value, start_index);
1468 return result > start_index + count ? npos : result;
1469 }
1470
1474 xtd::size index_of_any(const xtd::array<value_type>& values) const noexcept;
1480 xtd::size index_of_any(const xtd::array<value_type>& values, xtd::size start_index) const;
1489 xtd::size index_of_any(const std::initializer_list<value_type>& values) const noexcept;
1490 xtd::size index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index) const;
1491 xtd::size index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index, xtd::size count) const;
1493
1500 basic_string insert(xtd::size start_index, const basic_string& value) const {
1501 if (start_index > size()) __throw_basic_string_index_out_of_range_exception(__FILE__, __LINE__, __func__);
1502 auto result = *this;
1503 result.chars_.insert(start_index, value);
1504 return result;
1505 }
1506
1510 [[deprecated("Replaced by xtd::basic_string::is_empty(const xtd::basic_string&) - Will be removed in version 0.4.0.")]]
1511 bool is_empty() const noexcept {return is_empty(*this);}
1512
1516 xtd::size last_index_of(const basic_string& value) const noexcept {return last_index_of(value, 0, size());}
1522 xtd::size last_index_of(const basic_string& value, xtd::size start_index) const {return last_index_of(value, start_index, size() - start_index);}
1529 xtd::size last_index_of(const basic_string& value, xtd::size start_index, xtd::size count) const {
1530 if (start_index > size() || start_index + count > size()) __throw_basic_string_index_out_of_range_exception(__FILE__, __LINE__, __func__);
1531 auto result = rfind(value, start_index + count - value.size());
1532 return result < start_index ? npos : result;
1533 }
1537 xtd::size last_index_of(value_type value) const noexcept {return last_index_of(value, 0, size());}
1543 xtd::size last_index_of(value_type value, xtd::size start_index) const {return last_index_of(value, start_index, size() - start_index);}
1552 if (start_index > size() || start_index + count > size()) __throw_basic_string_index_out_of_range_exception(__FILE__, __LINE__, __func__);
1553 auto result = rfind(value, start_index + count - 1);
1554 return result < start_index ? npos : result;
1555 }
1556
1573 xtd::size last_index_of_any(const std::initializer_list<value_type>& values) const noexcept;
1574 xtd::size last_index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index) const;
1575 xtd::size last_index_of_any(const std::initializer_list<value_type>& values, xtd::size start_index, xtd::size count) const;
1577
1583 basic_string pad_left(xtd::size total_width) const noexcept {return pad_left(total_width, ' ');}
1590 basic_string pad_left(xtd::size total_width, char32 padding_char) const noexcept {return total_width < size() ? *this : basic_string(total_width - size(), padding_char) + *this;}
1591
1597 basic_string pad_right(xtd::size total_width) const noexcept {return pad_right(total_width, ' ');}
1604 basic_string pad_right(xtd::size total_width, char32 padding_char) const noexcept {return total_width < size() ? *this : *this + basic_string(total_width - size(), padding_char);}
1605
1610 basic_string quoted() const {return quoted('"', '\\');}
1615 basic_string quoted(value_type delimiter) const {return quoted(delimiter, '\\');}
1622 std::wstringstream ss;
1623 if constexpr (std::is_same_v<xtd::wchar, value_type>) ss << std::quoted(chars_, delimiter, escape);
1624 else ss << std::quoted(__xtd_convert_to_string<xtd::wchar>(chars_), static_cast<xtd::wchar>(delimiter), static_cast<xtd::wchar>(escape));
1625 return ss.str();
1626 }
1627
1631 basic_string remove(xtd::size start_index) const {return remove(start_index, size() - start_index);}
1637 if (start_index > size() || start_index + count > size()) __throw_basic_string_index_out_of_range_exception(__FILE__, __LINE__, __func__);
1638 auto result = *this;
1639 result.chars_.erase(start_index, count);
1640 return result;
1641 }
1642
1647 basic_string replace(value_type old_char, value_type new_char) const noexcept {return replace(string(1, old_char), string(1, new_char));}
1653 basic_string replace(const basic_string& old_string, const basic_string& new_string) const noexcept {
1654 auto result = *this;
1655 auto old_size = old_string.size();
1656 auto new_size = new_string.size();
1657 auto index = xtd::size {0};
1658 while (true) {
1659 index = result.find(old_string, index);
1660 if (index == npos) break;
1661 if (old_size == new_size) result.chars_.replace(index, old_size, new_string);
1662 else {
1663 result.chars_.erase(index, old_string.size());
1664 result.chars_.insert(index, new_string);
1665 }
1666 index += new_string.size();
1667 }
1668 return result;
1669 }
1670
1674 size_type rfind(const basic_string& str) const {return chars_.rfind(str);}
1680 size_type rfind(const basic_string& str, size_type pos) const {return chars_.rfind(str, pos);}
1688 size_type rfind(const_pointer s, size_type pos, size_type count) const {return chars_.rfind(s, pos, count);}
1694 size_type rfind(const_pointer s) const {return chars_.rfind(s);}
1701 size_type rfind(const_pointer s, size_type pos) const {return chars_.rfind(s, pos);}
1706 size_type rfind(value_type ch) const {return chars_.rfind(ch);}
1712 size_type rfind(value_type ch, size_type pos) const {return chars_.rfind(ch, pos);}
1713
1768 xtd::array<basic_string> split(const xtd::array<value_type>& separators) const noexcept;
1785 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::string_split_options options) const noexcept;
1794 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::size count) const noexcept;
1806 xtd::array<basic_string> split(const xtd::array<value_type>& separators, xtd::size count, xtd::string_split_options options) const noexcept;
1807
1812 bool starts_with(value_type value) const noexcept {return starts_with(value, false);}
1818 bool starts_with(value_type value, bool ignore_case) const noexcept {
1819 if (ignore_case) return to_lower().find(static_cast<value_type>(tolower(value))) == 0;
1820 return find(value) == 0;
1821 }
1826 bool starts_with(const basic_string& value) const noexcept {return starts_with(value, string_comparison::ordinal);}
1832 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);}
1837 bool starts_with(const basic_string& value, xtd::string_comparison comparison_type) const noexcept {
1838 if (comparison_type == xtd::string_comparison::ordinal_ignore_case) return to_lower().find(value.to_lower()) == 0;
1839 return find(value) == 0;
1840 }
1841
1846 basic_string substr() const {return chars_.substr();}
1853 if (pos > size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
1854 return chars_.substr(pos);
1855 }
1863 if (pos > size() || pos + count > size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
1864 return chars_.substr(pos, count);
1865 }
1866
1872 basic_string substring(xtd::size start_index) const {
1873 if (start_index > size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
1874 return substr(start_index);
1875 }
1882 if (start_index > size() || start_index + length > size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
1883 return substr(start_index, length);
1884 }
1885
1892 xtd::array<value_type> to_array(xtd::size start_index) const;
1897 xtd::array<value_type> to_array(xtd::size start_index, xtd::size length) const;
1898
1901 xtd::array<value_type> to_char_array() const noexcept;
1907
1910 basic_string to_lower() const noexcept {
1911 auto result = basic_string::empty_string;
1912 std::for_each(chars_.begin(), chars_.end(), [&](auto c) {result += static_cast<value_type>(std::tolower(c));});
1913 return result;
1914 }
1915
1919 basic_string<char> to_string() const noexcept override {
1920 if constexpr (std::is_same_v<char, char_t>) return chars_;
1921 else return __xtd_convert_to_string<char>(chars_);
1922 }
1923
1926 basic_string to_title_case() const noexcept;
1927
1931 if constexpr (std::is_same_v<xtd::char16, char_t>) return chars_;
1932 else return __xtd_convert_to_string<xtd::char16>(chars_);
1933 }
1934
1938 if constexpr (std::is_same_v<xtd::char32, char_t>) return chars_;
1939 else return __xtd_convert_to_string<xtd::char32>(chars_);
1940 }
1941
1942#if defined(__xtd__cpp_lib_char8_t)
1946 if constexpr (std::is_same_v<xtd::char8, char_t>) return chars_;
1947 else return __xtd_convert_to_string<xtd::char8>(chars_);
1948 }
1949#endif
1950
1953 basic_string to_upper() const noexcept {
1954 auto result = basic_string::empty_string;
1955 std::for_each(chars_.begin(), chars_.end(), [&](auto c) {result += static_cast<value_type>(std::toupper(c));});
1956 return result;
1957 }
1958
1962 if constexpr (std::is_same_v<xtd::wchar, char_t>) return chars_;
1963 else return __xtd_convert_to_string<xtd::wchar>(chars_);
1964 }
1965
1970 basic_string trim() const noexcept {return trim(default_trim_chars);}
1975 basic_string trim(value_type trim_char) const noexcept;
1980 basic_string trim(const xtd::array<value_type>& trim_chars) const noexcept;
1981
1986 basic_string trim_end() const noexcept {return trim_end(default_trim_chars);}
1991 basic_string trim_end(value_type trim_char) const noexcept;
1996 basic_string trim_end(const xtd::array<value_type>& trim_chars) const noexcept;
1997
2002 basic_string trim_start() const noexcept {return trim_start(default_trim_chars);}
2007 basic_string trim_start(value_type trim_char) const noexcept;
2012 basic_string trim_start(const xtd::array<value_type>& trim_chars) const noexcept;
2014
2016
2022 template<typename object_t>
2023 [[deprecated("Replaced by typeof_<object_t>().name() - Will be removed in version 0.4.0.")]]
2024 static basic_string class_name() {return get_class_name(full_class_name<object_t>());}
2029 template<typename object_t>
2030 [[deprecated("Replaced by typeof_(object).name() - Will be removed in version 0.4.0.")]]
2031 static basic_string class_name(const object_t& object) {return get_class_name(full_class_name(object));}
2036 [[deprecated("Replaced by typeof_(info).name() - Will be removed in version 0.4.0.")]]
2037 static basic_string class_name(const std::type_info& info) {return __xtd_get_class_name(info);}
2038
2048 static int32 compare(const basic_string& str_a, const basic_string& str_b) noexcept {return compare(str_a, str_b, false);}
2059 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);}
2070 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);}
2083 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);}
2097 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);}
2111 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));}
2112
2119 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;}
2126 template<typename object_a_t, typename object_b_t, typename object_c_t, typename object_d_t>
2127 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);}
2133 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;}
2139 template<typename object_a_t, typename object_b_t, typename object_c_t>
2140 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);}
2145 static basic_string concat(const basic_string& str_a, const basic_string& str_b) noexcept {return str_a + str_b;}
2150 template<typename object_a_t, typename object_b_t>
2151 static basic_string concat(object_a_t obj_a, object_b_t obj_b) noexcept {return format("{}{}", obj_a, obj_b);}
2155 static basic_string concat(const xtd::array<basic_string>& values) noexcept;
2157 static basic_string concat(const xtd::array<const_pointer>& values) noexcept;
2158 template<typename other_char_t>
2159 static basic_string concat(const xtd::array<const other_char_t*>& values) noexcept;
2160 static basic_string concat(const std::initializer_list<basic_string>& values) noexcept {
2161 auto result = basic_string::empty_string;
2162 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2163 return result;
2164 }
2165 static basic_string concat(const std::initializer_list<const_pointer>& values) noexcept {
2166 auto result = basic_string::empty_string;
2167 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2168 return result;
2169 }
2170 template<typename other_char_t>
2171 static basic_string concat(const std::initializer_list<const other_char_t*>& values) noexcept {
2172 auto result = basic_string::empty_string;
2173 std::for_each(values.begin(), values.end(), [&](const auto & item) {result += item;});
2174 return result;
2175 }
2180 template<typename object_t>
2181 static basic_string concat(const xtd::array<object_t>& args) noexcept;
2183 template<typename object_t>
2184 static basic_string concat(const std::initializer_list<object_t>& args) noexcept {
2185 basic_string result;
2186 for (const auto& arg : args)
2187 result += format("{}", arg);
2188 return result;
2189 }
2194 template<typename value_t>
2195 static basic_string concat(value_t value) noexcept {
2196 return format("{}", value);
2197 }
2198
2219 static basic_string demangle(const basic_string& name) {
2220 if constexpr (std::is_same_v<char, char_t>) return __xtd_demangle(name.chars());
2221 else return __xtd_demangle(__xtd_convert_to_string<char>(name.chars()));
2222 }
2223
2229 static bool equals(const basic_string& a, const basic_string& b) noexcept{return a.equals(b);}
2235 template<typename char_a_t, typename char_b_t>
2236 static bool equals(const char_a_t* a, const char_b_t* b) noexcept{return basic_string {a}.equals(basic_string {b});}
2237
2244 static bool equals(const basic_string& a, const basic_string& b, bool ignore_case) noexcept {return a.equals(b, ignore_case);}
2251 template<typename char_a_t, typename char_b_t>
2252 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);}
2253
2260 template<typename ...args_t>
2261 static basic_string format(const basic_string<char>& fmt, args_t&& ... args);
2262
2267 template<typename object_t>
2268 [[deprecated("Replaced by typeof_<object_t>().full_name() - Will be removed in version 0.4.0.")]]
2269 static basic_string full_class_name() {return demangle(typeid(object_t).name());}
2274 template<typename object_t>
2275 [[deprecated("Replaced by typeof_(object).full_name() - Will be removed in version 0.4.0.")]]
2276 static basic_string full_class_name(const object_t& object) {return demangle(typeid(object).name());}
2281 [[deprecated("Replaced by typeof_(info).full_name() - Will be removed in version 0.4.0.")]]
2282 static basic_string full_class_name(const std::type_info& info) {return __xtd_get_full_class_name(info);}
2283
2287 static bool is_empty(const xtd::basic_string<value_type, traits_type, allocator_type>& string) noexcept {return !string.length();}
2288
2295 template<typename collection_t>
2296 static basic_string join(const basic_string separator, const collection_t& values) noexcept {
2297 xtd::size i = 0;
2298 basic_string result;
2299 for (const auto& item : values) {
2300 if (i++ != 0) result += separator;
2301 result += format("{}", item);
2302 }
2303 return result;
2304 }
2312 template<typename collection_t>
2313 static basic_string join(const basic_string& separator, const collection_t& values, xtd::size index) {return join(separator, values, index, values.size() - index);}
2322 template<typename collection_t>
2323 static basic_string join(const basic_string& separator, const collection_t& values, xtd::size index, xtd::size count) {
2324 if (index > values.size() || index + count > values.size()) __throw_basic_string_argument_out_of_range_exception(__FILE__, __LINE__, __func__);
2325 xtd::size i = 0;
2326 basic_string result;
2327 for (const auto& item : values) {
2328 if (i >= index) {
2329 if (i != index) result += separator;
2330 result += format("{}", item);
2331 }
2332 if (++i >= index + count) break;
2333 }
2334 return result;
2335 }
2337 template<typename value_t>
2338 static basic_string join(const basic_string& separator, const std::initializer_list<value_t>& values) noexcept;
2339 template<typename value_t>
2340 static basic_string join(const basic_string& separator, const std::initializer_list<value_t>& values, xtd::size index);
2341 template<typename value_t>
2342 static basic_string join(const basic_string& separator, const std::initializer_list<value_t>& values, xtd::size index, xtd::size count);
2344
2348 template<typename value_t>
2349 static value_t parse(const basic_string& str) {
2350 if constexpr (std::is_same_v<char, char_t>) return xtd::parse<value_t>(str.chars());
2351 else return xtd::parse<value_t>(__xtd_convert_to_string<char>(str.chars()));
2352 }
2353
2413 template<typename ... args_t>
2414 static basic_string sprintf(const basic_string& fmt, args_t&& ... args) noexcept {return __sprintf(fmt.c_str(), convert_param(std::forward<args_t>(args)) ...);}
2415
2420 template<typename value_t>
2421 static bool try_parse(const basic_string& str, value_t& value) noexcept {
2422 try {
2423 value = parse<value_t>(str);
2424 return true;
2425 } catch (...) {
2426 return false;
2427 }
2428 }
2430
2432
2439 if (index >= length()) __throw_basic_string_index_out_of_range_exception(__FILE__, __LINE__, __func__);
2440 return chars_[index];
2441 }
2442
2445 operator const base_type&() const noexcept {return chars_;}
2446
2451 if constexpr(std::is_same<char_t, char>::value) chars_ = str.chars_;
2452 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2453 return *this;
2454 }
2459 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str.chars_;
2460 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2461 return *this;
2462 }
2467 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str.chars_;
2468 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2469 return *this;
2470 }
2471#if defined(__xtd__cpp_lib_char8_t)
2476 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str.chars_;
2477 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2478 return *this;
2479 }
2480#endif
2485 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str.chars_;
2486 else chars_ = __xtd_convert_to_string<value_type>(str.chars());
2487 return *this;
2488 }
2489
2494 if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str.chars_);
2495 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2496 return *this;
2497 }
2502 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str.chars_);
2503 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2504 return *this;
2505 }
2510 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str.chars_);
2511 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2512 return *this;
2513 }
2514#if defined(__xtd__cpp_lib_char8_t)
2519 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str.chars_);
2520 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2521 return *this;
2522 }
2523#endif
2528 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str.chars_);
2529 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_)));
2530 return *this;
2531 }
2532
2536 basic_string& operator =(const std::basic_string<char>& str) noexcept {
2537 if constexpr(std::is_same<char_t, char>::value) chars_ = str;
2538 else chars_ = __xtd_convert_to_string<value_type>(str);
2539 return *this;
2540 }
2544 basic_string& operator =(const std::basic_string<xtd::char16>& str) noexcept {
2545 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str;
2546 else chars_ = __xtd_convert_to_string<value_type>(str);
2547 return *this;
2548 }
2552 basic_string& operator =(const std::basic_string<xtd::char32>& str) noexcept {
2553 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str;
2554 else chars_ = __xtd_convert_to_string<value_type>(str);
2555 return *this;
2556 }
2557#if defined(__xtd__cpp_lib_char8_t)
2561 basic_string& operator =(const std::basic_string<xtd::char8>& str) noexcept {
2562 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str;
2563 else chars_ = __xtd_convert_to_string<value_type>(str);
2564 return *this;
2565 }
2566#endif
2570 basic_string& operator =(const std::basic_string<xtd::wchar>& str) noexcept {
2571 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str;
2572 else chars_ = __xtd_convert_to_string<value_type>(str);
2573 return *this;
2574 }
2575
2579 basic_string& operator =(std::basic_string<char>&& str) noexcept {
2580 if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str);
2581 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2582 return *this;
2583 }
2587 basic_string& operator =(std::basic_string<xtd::char16>&& str) noexcept {
2588 if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str);
2589 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2590 return *this;
2591 }
2595 basic_string& operator =(std::basic_string<xtd::char32>&& str) noexcept {
2596 if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str);
2597 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2598 return *this;
2599 }
2600#if defined(__xtd__cpp_lib_char8_t)
2604 basic_string& operator =(std::basic_string<xtd::char8>&& str) noexcept {
2605 if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str);
2606 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2607 return *this;
2608 }
2609#endif
2613 basic_string& operator =(std::basic_string<xtd::wchar>&& str) noexcept {
2614 if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str);
2615 else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str)));
2616 return *this;
2617 }
2618
2623 basic_string& operator =(const char* str) {
2624 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
2625 if constexpr (std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str);
2626 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str));
2627 return *this;
2628 }
2634 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
2635 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str);
2636 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str));
2637 return *this;
2638 }
2644 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
2645 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str);
2646 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str));
2647 return *this;
2648 }
2649#if defined(__xtd__cpp_lib_char8_t)
2655 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
2656 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str);
2657 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str));
2658 return *this;
2659 }
2660#endif
2666 if (str == null) __throw_basic_string_null_pointer_exception(__FILE__, __LINE__, __func__);
2667 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str);
2668 else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str));
2669 return *this;
2670 }
2671
2675 basic_string& operator =(char character) {
2676 *this = basic_string(1, character);
2677 return *this;
2678 }
2683 *this = basic_string(1, character);
2684 return *this;
2685 }
2690 *this = basic_string(1, character);
2691 return *this;
2692 }
2693#if defined(__xtd__cpp_lib_char8_t)
2698 *this = basic_string(1, character);
2699 return *this;
2700 }
2701#endif
2706 *this = basic_string(1, character);
2707 return *this;
2708 }
2709
2713 basic_string& operator =(const std::initializer_list<char>& il) {
2714 *this = basic_string(il);
2715 return *this;
2716 }
2720 basic_string& operator =(const std::initializer_list<xtd::char16>& il) {
2721 *this = basic_string(il);
2722 return *this;
2723 }
2727 basic_string& operator =(const std::initializer_list<xtd::char32>& il) {
2728 *this = basic_string(il);
2729 return *this;
2730 }
2731#if defined(__xtd__cpp_lib_char8_t)
2735 basic_string& operator =(const std::initializer_list<xtd::char8>& il) {
2736 *this = basic_string(il);
2737 return *this;
2738 }
2739#endif
2743 basic_string& operator =(const std::initializer_list<xtd::wchar>& il) {
2744 *this = basic_string(il);
2745 return *this;
2746 }
2747
2752 if constexpr (std::is_same_v<char, char_t>) chars_ += str.chars_;
2753 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2754 return *this;
2755 }
2760 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ += str.chars_;
2761 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2762 return *this;
2763 }
2768 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ += str.chars_;
2769 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2770 return *this;
2771 }
2772#if defined(__xtd__cpp_lib_char8_t)
2777 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ += str.chars_;
2778 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2779 return *this;
2780 }
2781#endif
2786 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ += str.chars_;
2787 else chars_ += __xtd_convert_to_string<value_type>(str.chars_);
2788 return *this;
2789 }
2790
2795 if constexpr (std::is_same_v<char, char_t>) chars_ += std::move(str.chars_);
2796 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2797 return *this;
2798 }
2803 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ += std::move(str.chars_);
2804 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2805 return *this;
2806 }
2811 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ += std::move(str.chars_);
2812 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2813 return *this;
2814 }
2815#if defined(__xtd__cpp_lib_char8_t)
2820 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ += std::move(str.chars_);
2821 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2822 return *this;
2823 }
2824#endif
2829 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ += std::move(str.chars_);
2830 else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_));
2831 return *this;
2832 }
2833
2837 basic_string& operator +=(const std::basic_string<char>& str) {
2838 if constexpr (std::is_same_v<char, char_t>) chars_ += str;
2839 else chars_ += __xtd_convert_to_string<value_type>(str);
2840 return *this;
2841 }
2845 basic_string& operator +=(const std::basic_string<xtd::char16>& str) {
2846 if constexpr (std::is_same_v<xtd::char16, char_t>) chars_ += str;
2847 else chars_ += __xtd_convert_to_string<value_type>(str);
2848 return *this;
2849 }
2853 basic_string& operator +=(const std::basic_string<xtd::char32>& str) {
2854 if constexpr (std::is_same_v<xtd::char32, char_t>) chars_ += str;
2855 else chars_ += __xtd_convert_to_string<value_type>(str);
2856 return *this;
2857 }
2858#if defined(__xtd__cpp_lib_char8_t)
2862 basic_string& operator +=(const std::basic_string<xtd::char8>& str) {
2863 if constexpr (std::is_same_v<xtd::char8, char_t>) chars_ += str;
2864 else chars_ += __xtd_convert_to_string<value_type>(str);
2865 return *this;
2866 }
2867#endif
2871 basic_string& operator +=(const std::basic_string<xtd::wchar>& str) {
2872 if constexpr (std::is_same_v<xtd::wchar, char_t>) chars_ += str;
2873 else chars_ += __xtd_convert_to_string<value_type>(str);
2874 return *this;
2875 }
2876
2880 basic_string& operator +=(const char* str) {
2881 chars_ += basic_string(str).chars_;
2882 return *this;
2883 }
2888 chars_.append(basic_string(str).chars_); return *this;
2889 }
2894 chars_ += basic_string(str).chars_;
2895 return *this;
2896 }
2897#if defined(__xtd__cpp_lib_char8_t)
2902 chars_ += basic_string(str).chars_;
2903 return *this;
2904 }
2905#endif
2910 chars_ += basic_string(str).chars_;
2911 return *this;
2912 }
2917 chars_ += basic_string(1, ch).chars_;
2918 return *this;
2919 }
2924 chars_ += basic_string(1, ch).chars_;
2925 return *this;
2926 }
2931 chars_ += basic_string(1, ch).chars_;
2932 return *this;
2933 }
2934#if defined(__xtd__cpp_lib_char8_t)
2939 chars_ += basic_string(1, ch).chars_;
2940 return *this;
2941 }
2942#endif
2947 chars_ += basic_string(1, ch).chars_;
2948 return *this;
2949 }
2950
2956 auto result = lhs;
2957 result += rhs;
2958 return result;
2959 }
2965 auto result = lhs;
2966 result += rhs;
2967 return result;
2968 }
2974 auto result = lhs;
2975 result += rhs;
2976 return result;
2977 }
2978#if defined(__xtd__cpp_lib_char8_t)
2984 auto result = lhs;
2985 result += rhs;
2986 return result;
2987 }
2988#endif
2994 auto result = lhs;
2995 result += rhs;
2996 return result;
2997 }
2998
3004 auto result = std::move(lhs);
3005 result += std::move(rhs);
3006 return result;
3007 }
3013 auto result = std::move(lhs);
3014 result += std::move(rhs);
3015 return result;
3016 }
3022 auto result = std::move(lhs);
3023 result += std::move(rhs);
3024 return result;
3025 }
3026#if defined(__xtd__cpp_lib_char8_t)
3032 auto result = std::move(lhs);
3033 result += std::move(rhs);
3034 return result;
3035 }
3036#endif
3042 auto result = std::move(lhs);
3043 result += std::move(rhs);
3044 return result;
3045 }
3046
3052 auto result = std::move(lhs);
3053 result += rhs;
3054 return result;
3055 }
3061 auto result = std::move(lhs);
3062 result += rhs;
3063 return result;
3064 }
3070 auto result = std::move(lhs);
3071 result += rhs;
3072 return result;
3073 }
3074#if defined(__xtd__cpp_lib_char8_t)
3080 auto result = std::move(lhs);
3081 result += rhs;
3082 return result;
3083 }
3084#endif
3090 auto result = std::move(lhs);
3091 result += rhs;
3092 return result;
3093 }
3094
3100 auto result = lhs;
3101 result += std::move(rhs);
3102 return result;
3103 }
3109 auto result = lhs;
3110 result += std::move(rhs);
3111 return result;
3112 }
3118 auto result = lhs;
3119 result += std::move(rhs);
3120 return result;
3121 }
3122#if defined(__xtd__cpp_lib_char8_t)
3128 auto result = lhs;
3129 result += std::move(rhs);
3130 return result;
3131 }
3132#endif
3138 auto result = lhs;
3139 result += std::move(rhs);
3140 return result;
3141 }
3142
3147 friend basic_string operator +(const basic_string& lhs, const std::basic_string<char>& rhs) {
3148 auto result = lhs;
3149 result += rhs;
3150 return result;
3151 }
3156 friend basic_string operator +(const basic_string& lhs, const std::basic_string<xtd::char16>& rhs) {
3157 auto result = lhs;
3158 result += rhs;
3159 return result;
3160 }
3165 friend basic_string operator +(const basic_string& lhs, const std::basic_string<xtd::char32>& rhs) {
3166 auto result = lhs;
3167 result += rhs;
3168 return result;
3169 }
3170#if defined(__xtd__cpp_lib_char8_t)
3175 friend basic_string operator +(const basic_string& lhs, const std::basic_string<xtd::char8>& rhs) {
3176 auto result = lhs;
3177 result += rhs;
3178 return result;
3179 }
3180#endif
3185 friend basic_string operator +(const basic_string& lhs, const std::basic_string<xtd::wchar>& rhs) {
3186 auto result = lhs;
3187 result += rhs;
3188 return result;
3189 }
3190
3195 friend basic_string operator +(const std::basic_string<char>& lhs, const basic_string& rhs) {
3196 auto result = lhs;
3197 if constexpr (std::is_same_v<char, char_t>) result += rhs.chars();
3198 else result += __xtd_convert_to_string<char>(rhs.chars());
3199 return result;
3200 }
3205 friend basic_string operator +(const std::basic_string<xtd::char16>& lhs, const basic_string& rhs) {
3206 auto result = lhs;
3207 if constexpr (std::is_same_v<xtd::char16, char_t>) result += rhs.chars();
3208 else result += __xtd_convert_to_string<xtd::char16>(rhs.chars());
3209 return result;
3210 }
3215 friend basic_string operator +(const std::basic_string<xtd::char32>& lhs, const basic_string& rhs) {
3216 auto result = lhs;
3217 if constexpr (std::is_same_v<xtd::char32, char_t>) result += rhs.chars();
3218 else result += __xtd_convert_to_string<xtd::char32>(rhs.chars());
3219 return result;
3220 }
3221#if defined(__xtd__cpp_lib_char8_t)
3226 friend basic_string operator +(const std::basic_string<xtd::char8>& lhs, const basic_string& rhs) {
3227 auto result = lhs;
3228 if constexpr (std::is_same_v<xtd::char8, char_t>) result += rhs.chars();
3229 else result += __xtd_convert_to_string<xtd::char8>(rhs.chars());
3230 return result;
3231 }
3232#endif
3237 friend basic_string operator +(const std::basic_string<xtd::wchar>& lhs, const basic_string& rhs) {
3238 auto result = lhs;
3239 if constexpr (std::is_same_v<xtd::wchar, char_t>) result += rhs.chars();
3240 else result += __xtd_convert_to_string<xtd::wchar>(rhs.chars());
3241 return result;
3242 }
3243
3248 friend basic_string operator +(const basic_string& lhs, const char* rhs) {
3249 auto result = lhs;
3250 result += rhs;
3251 return result;
3252 }
3257 friend basic_string operator +(const basic_string& lhs, const xtd::char16* rhs) {
3258 auto result = lhs;
3259 result += rhs;
3260 return result;
3261 }
3266 friend basic_string operator +(const basic_string& lhs, const xtd::char32* rhs) {
3267 auto result = lhs;
3268 result += rhs;
3269 return result;
3270 }
3271#if defined(__xtd__cpp_lib_char8_t)
3276 friend basic_string operator +(const basic_string& lhs, const xtd::char8* rhs) {
3277 auto result = lhs;
3278 result += rhs;
3279 return result;
3280 }
3281#endif
3286 friend basic_string operator +(const basic_string& lhs, const xtd::wchar* rhs) {
3287 auto result = lhs;
3288 result += rhs;
3289 return result;
3290 }
3291
3296 friend basic_string operator +(basic_string&& lhs, const char* rhs) {
3297 auto result = std::move(lhs);
3298 result += rhs;
3299 return result;
3300 }
3306 auto result = std::move(lhs);
3307 result += rhs;
3308 return result;
3309 }
3315 auto result = std::move(lhs);
3316 result += rhs;
3317 return result;
3318 }
3319#if defined(__xtd__cpp_lib_char8_t)
3325 auto result = std::move(lhs);
3326 result += rhs;
3327 return result;
3328 }
3329#endif
3335 auto result = std::move(lhs);
3336 result += rhs;
3337 return result;
3338 }
3339
3344 friend basic_string operator +(const char* lhs, const basic_string& rhs) {
3345 auto result = basic_string(lhs);
3346 result += rhs;
3347 return result;
3348 }
3353 friend basic_string operator +(const xtd::char16* lhs, const basic_string& rhs) {
3354 auto result = basic_string(lhs);
3355 result += rhs;
3356 return result;
3357 }
3362 friend basic_string operator +(const xtd::char32* lhs, const basic_string& rhs) {
3363 auto result = basic_string(lhs);
3364 result += rhs;
3365 return result;
3366 }
3367#if defined(__xtd__cpp_lib_char8_t)
3372 friend basic_string operator +(const xtd::char8* lhs, const basic_string& rhs) {
3373 auto result = basic_string(lhs);
3374 result += rhs;
3375 return result;
3376 }
3377#endif
3382 friend basic_string operator +(const xtd::wchar* lhs, const basic_string& rhs) {
3383 auto result = basic_string(lhs);
3384 result += rhs;
3385 return result;
3386 }
3387
3392 friend basic_string operator +(const char* lhs, basic_string&& rhs) {
3393 auto result = basic_string(lhs);
3394 result += std::move(rhs);
3395 return result;
3396 }
3402 auto result = basic_string(lhs);
3403 result += std::move(rhs);
3404 return result;
3405 }
3411 auto result = basic_string(lhs);
3412 result += std::move(rhs);
3413 return result;
3414 }
3415
3416#if defined(__xtd__cpp_lib_char8_t)
3422 auto result = basic_string(lhs);
3423 result += std::move(rhs);
3424 return result;
3425 }
3426#endif
3432 auto result = basic_string(lhs);
3433 result += std::move(rhs);
3434 return result;
3435 }
3436
3441 friend basic_string operator +(const basic_string& lhs, const char rhs) {
3442 auto result = lhs;
3443 result += rhs;
3444 return result;
3445 }
3450 friend basic_string operator +(const basic_string& lhs, const xtd::char16 rhs) {
3451 auto result = lhs;
3452 result += rhs;
3453 return result;
3454 }
3459 friend basic_string operator +(const basic_string& lhs, const xtd::char32 rhs) {
3460 auto result = lhs;
3461 result += rhs;
3462 return result;
3463 }
3464#if defined(__xtd__cpp_lib_char8_t)
3469 friend basic_string operator +(const basic_string& lhs, const xtd::char8 rhs) {
3470 auto result = lhs;
3471 result += rhs;
3472 return result;
3473 }
3474#endif
3479 friend basic_string operator +(const basic_string& lhs, const xtd::wchar rhs) {
3480 auto result = lhs;
3481 result += rhs;
3482 return result;
3483 }
3484
3489 friend basic_string operator +(basic_string&& lhs, const char rhs) {
3490 auto result = std::move(lhs);
3491 result += rhs;
3492 return result;
3493 }
3499 auto result = std::move(lhs);
3500 result += rhs;
3501 return result;
3502 }
3508 auto result = std::move(lhs);
3509 result += rhs;
3510 return result;
3511 }
3512#if defined(__xtd__cpp_lib_char8_t)
3518 auto result = std::move(lhs);
3519 result += rhs;
3520 return result;
3521 }
3522#endif
3528 auto result = std::move(lhs);
3529 result += rhs;
3530 return result;
3531 }
3532
3537 friend basic_string operator +(char lhs, const basic_string& rhs) {
3538 auto result = basic_string(1, lhs);
3539 result += rhs;
3540 return result;
3541 }
3547 auto result = basic_string(1, lhs);
3548 result += rhs;
3549 return result;
3550 }
3556 auto result = basic_string(1, lhs);
3557 result += rhs;
3558 return result;
3559 }
3560#if defined(__xtd__cpp_lib_char8_t)
3566 auto result = basic_string(1, lhs);
3567 result += rhs;
3568 return result;
3569 }
3570#endif
3576 auto result = basic_string(1, lhs);
3577 result += rhs;
3578 return result;
3579 }
3580
3585 friend basic_string operator +(char lhs, basic_string&& rhs) {
3586 auto result = basic_string(1, lhs);
3587 result += std::move(rhs);
3588 return result;
3589 }
3595 auto result = basic_string(1, lhs);
3596 result += std::move(rhs);
3597 return result;
3598 }
3604 auto result = basic_string(1, lhs);
3605 result += std::move(rhs);
3606 return result;
3607 }
3608#if defined(__xtd__cpp_lib_char8_t)
3614 auto result = basic_string(1, lhs);
3615 result += std::move(rhs);
3616 return result;
3617 }
3618#endif
3624 auto result = basic_string(1, lhs);
3625 result += std::move(rhs);
3626 return result;
3627 }
3628
3637 //friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string& str) {return stream << str.to_string().chars_;}
3638 friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string& str) {
3639 if constexpr (std::is_same_v<char, char_t>) return stream << str.chars();
3640 else return stream << __xtd_convert_to_string<char>(str.chars());
3641 }
3648 friend std::basic_ostream<xtd::wchar>& operator <<(std::basic_ostream<xtd::wchar>& stream, const basic_string& str) {return stream << str.to_wstring().chars();}
3649
3658 friend std::basic_istream<char>& operator >>(std::basic_istream<char>& stream, basic_string& str) {
3659 auto s = std::basic_string<char> {};
3660 stream >> s;
3661 str = s;
3662 return stream;
3663 }
3672 friend std::basic_istream<xtd::wchar>& operator >>(std::basic_istream<xtd::wchar>& stream, basic_string& str) {
3673 auto s = std::basic_string<xtd::wchar> {};
3674 stream >> s;
3675 str = s;
3676 return stream;
3677 }
3679
3680 private:
3681 friend class basic_string<char>;
3682 friend class basic_string<xtd::char16>;
3683 friend class basic_string<xtd::char32>;
3684#if defined(__xtd__cpp_lib_char8_t)
3685 friend class basic_string<xtd::char8>;
3686#endif
3687 friend class basic_string<xtd::wchar>;
3688
3689 static const xtd::array<value_type> default_split_separators;
3690 static const xtd::array<value_type> default_trim_chars;
3691
3692 template<typename arg_t>
3693 static auto convert_param(arg_t&& arg) noexcept {
3694 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();
3695 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();
3696 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();
3697#if defined(__xtd__cpp_lib_char8_t)
3698 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();
3699#endif
3700 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();
3701 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();
3702 else return std::forward<arg_t>(arg);
3703 }
3704
3705 static basic_string get_class_name(const basic_string& full_name) {
3706 auto length = full_name.last_index_of("<");
3707 if (length == npos) length = full_name.length();
3708 if (full_name.last_index_of("::", 0, length) == npos) return full_name;
3709 return full_name.substring(full_name.last_index_of("::", 0, length) + 2);
3710 }
3711
3712 typename base_type::iterator to_base_type_iterator(iterator value) const noexcept {
3713 if (value == begin()) return chars_.begin();
3714 if (value == end()) return chars_.end();
3715 return chars_.begin() + (value - begin());
3716 }
3717
3718 iterator to_iterator(typename base_type::iterator value) const noexcept {
3719 if (value == chars_.begin()) return begin();
3720 if (value == chars_.end()) return end();
3721 return begin() + (value - chars_.begin());
3722 }
3723
3724 base_type chars_;
3725 };
3726}
3727
3728#define __XTD_BASIC_STRING_INTERNAL__
3729#include "basic_string_.hpp"
3730#undef __XTD_BASIC_STRING_INTERNAL__
Contains array definitions.
Contains __format_information struct.
Contains __format method.
Contains string definitions.
Contains __xtd_std_version definitions.
Contains xtd::basic_string class.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:59
Represents text as a sequence of character units.
Definition basic_string.hpp:79
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:154
basic_string trim(value_type trim_char) const noexcept
Removes all leading and trailing occurrences of a character specified from the specified xtd::basic_s...
basic_string(const xtd::char8 *str, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring and count characters.
Definition basic_string.hpp:635
basic_string(const basic_string< xtd::char32 > &str, xtd::size index, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring at index and count character...
Definition basic_string.hpp:337
std::basic_string< char_t, traits_t, allocator_t > base_type
Represents the basic string base type.
Definition basic_string.hpp:86
static basic_string concat(object_a_t obj_a, object_b_t obj_b) noexcept
Concatenates two specified instances of object.
Definition basic_string.hpp:2151
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:1453
static int32 compare(const basic_string &str_a, const basic_string &str_b, xtd::string_comparison comparison_type) noexcept
Compares two specified basic_string objects using the specified rules, and returns an integer that in...
Definition basic_string.hpp:2070
basic_string trim_end(const xtd::array< value_type > &trim_chars) const noexcept
Removes all trailing occurrences of a set of characters specified in an array from the specified xtd:...
basic_string to_lower() const noexcept
Returns a copy of the current xtd::basic_string converted to lowercase.
Definition basic_string.hpp:1910
static value_t parse(const basic_string &str)
Converts a basic_string into a value_t type.
Definition basic_string.hpp:2349
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:1583
basic_string(const basic_string< char > &str, xtd::size index)
Initializes a new instance of xtd::basic_string with specified substring at index.
Definition basic_string.hpp:215
static const basic_string empty_string
Represents the empty basic_string.
Definition basic_string.hpp:124
basic_string(xtd::size count, xtd::char16 character, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:450
basic_string(const basic_string< xtd::char8 > &str, xtd::size index)
Initializes a new instance of xtd::basic_string with specified substring at index.
Definition basic_string.hpp:243
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:1176
static basic_string class_name(const object_t &object)
Gets the class name of the specified object.
Definition basic_string.hpp:2031
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:1374
basic_string(const xtd::char32 *str, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified string to copy, and allocator.
Definition basic_string.hpp:587
constexpr basic_string(const string_view_like_t &string_view)
Initializes a new instance of xtd::basic_string with specified string view of substring and allocator...
Definition basic_string.hpp:784
allocator_type get_allocator() const
Returns the allocator associated with the string.
Definition basic_string.hpp:1402
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:1465
basic_string(xtd::char16 character, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:499
basic_string(const xtd::char16 *str, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring, count characters and alloca...
Definition basic_string.hpp:662
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:1458
basic_string trim() const noexcept
Removes all leading and trailing occurrences of white-space characters from the specified xtd::basic_...
Definition basic_string.hpp:1970
xtd::array< basic_string > split() const noexcept
Splits this basic_string into substrings that are based on the default white-space characters....
const_reverse_iterator rbegin() const
Returns a reverse iterator to the first character of the string.
Definition basic_string.hpp:926
basic_string(xtd::size count, xtd::char8 character)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:464
basic_string(std::initializer_list< xtd::char16 > il, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified initializer list and allocator.
Definition basic_string.hpp:830
basic_string(const xtd::char8 *str, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified string to copy, and allocator.
Definition basic_string.hpp:596
basic_string(const xtd::char32 *str)
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:546
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:1228
xtd::size index_of_any(const xtd::array< value_type > &values, xtd::size start_index) const
Reports the index of the first occurrence in this instance of any character in a specified array of c...
typename base_type::allocator_type allocator_type
Represents the basic string allocator type.
Definition basic_string.hpp:92
basic_string substring(xtd::size start_index, xtd::size length) const
Retrieves a substring from this instance. The substring starts at a specified character position and ...
Definition basic_string.hpp:1881
basic_string(char character, xtd::size count)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:485
basic_string(const xtd::char16 *str, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified string to copy, and allocator.
Definition basic_string.hpp:579
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:1354
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:1159
basic_string(std::initializer_list< char > il, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified initializer list and allocator.
Definition basic_string.hpp:826
basic_string(const char *str, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring and count characters.
Definition basic_string.hpp:613
enumerator_type get_enumerator() const noexcept override
Returns an enumerator that iterates through a collection.
Definition basic_string.hpp:1412
static basic_string demangle(const basic_string &name)
Gets demangled basic_string of name,.
Definition basic_string.hpp:2219
basic_string(xtd::wchar character, xtd::size count)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:523
basic_string(input_iterator_t first, input_iterator_t last, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified first and last iterators of substring ...
Definition basic_string.hpp:778
basic_string(xtd::size count, xtd::char8 character, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:469
int32 compare(size_type pos1, size_type count1, const basic_string &str) const
Compares two character sequences.
Definition basic_string.hpp:985
typename xtd::collections::generic::enumerator< value_type > enumerator_type
Represents the basic string enumerator type.
Definition basic_string.hpp:116
size_type rfind(const_pointer s, size_type pos, size_type count) const
Finds the last substring that is equal to the given character sequence. The search begins at pos and ...
Definition basic_string.hpp:1688
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:1398
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:1694
size_type rfind(const basic_string &str) const
Finds the last substring that is equal to the given character sequence. The search begins at xtd::bas...
Definition basic_string.hpp:1674
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:161
basic_string(xtd::wchar character, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:528
basic_string(const basic_string< xtd::char8 > &str, xtd::size index, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring at index and count character...
Definition basic_string.hpp:348
basic_string(const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified allocator.
static bool try_parse(const basic_string &str, value_t &value) noexcept
Try to convert a basic_string into a value_t type.
Definition basic_string.hpp:2421
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:772
virtual const base_type & get_base_type() const noexcept
Returns the underlying base type.
Definition basic_string.hpp:1406
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:1299
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:1522
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:1336
basic_string(const basic_string< xtd::wchar > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:206
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:2282
typename base_type::const_pointer const_pointer
Represents the basic string const pointer type.
Definition basic_string.hpp:104
friend std::basic_istream< char > & operator>>(std::basic_istream< char > &stream, basic_string &str)
Input stream operator. Behaves as a FormattedInputFunction. After constructing and checking the sentr...
Definition basic_string.hpp:3658
basic_string(std::initializer_list< xtd::wchar > il)
Initializes a new instance of xtd::basic_string with specified initializer list.
Definition basic_string.hpp:821
int32 compare(size_type pos1, size_type count1, const_pointer s) const
Compares two character sequences.
Definition basic_string.hpp:1075
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:1343
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:1272
static basic_string concat(object_a_t obj_a, object_b_t obj_b, object_c_t obj_c, object_d_t obj_d) noexcept
Concatenates four specified instances of object.
Definition basic_string.hpp:2127
bool starts_with(const basic_string &value) const noexcept
Determines whether the beginning of this instance of xtd::basic_string matches a specified xtd::basic...
Definition basic_string.hpp:1826
basic_string(xtd::char8 character, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:518
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:1130
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:1234
static bool equals(const basic_string &a, const basic_string &b, bool ignore_case) noexcept
Determines whether two specified xtd::basic_string objects have the same value, ignoring or honoring ...
Definition basic_string.hpp:2244
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:1500
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:148
basic_string(basic_string &&str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to move and allocator.
Definition basic_string.hpp:430
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:1255
basic_string to_upper() const noexcept
Returns a copy of the current xtd::basic_string converted to uppercase.
Definition basic_string.hpp:1953
int32 compare(size_type pos1, size_type count1, const_pointer s, size_type count2) const
Compares two character sequences.
Definition basic_string.hpp:1098
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:699
typename base_type::traits_type traits_type
Represents the basic string traits type.
Definition basic_string.hpp:88
const base_type & chars() const noexcept
Returns a reference to the underlying base type.
Definition basic_string.hpp:883
basic_string trim_start(value_type trim_char) const noexcept
Removes all leading occurrences of a character specified from the specified xtd::basic_string .
xtd::size last_index_of(const basic_string &value, xtd::size start_index, xtd::size count) const
Reports the index of the last occurrence of the specified character in this basic_string....
Definition basic_string.hpp:1529
basic_string(const std::basic_string< xtd::char16 > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:740
static basic_string join(const basic_string &separator, const collection_t &values, xtd::size index, xtd::size count)
Concatenates a specified separator basic_string between each element of a specified Object array,...
Definition basic_string.hpp:2323
basic_string substring(xtd::size start_index) const
Retrieves a substring from this instance. The substring starts at a specified character position and ...
Definition basic_string.hpp:1872
typename base_type::pointer pointer
Represents the basic string pointer type.
Definition basic_string.hpp:102
xtd::size index_of_any(const xtd::array< value_type > &values) const noexcept
Reports the index of the first occurrence in this instance of any character in a specified array of c...
basic_string(char character, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:490
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:1304
basic_string substr(size_type pos, size_type count) const
Returns a substring [pos, pos + count). If the requested substring extends past the end of the string...
Definition basic_string.hpp:1862
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:1121
xtd::array< value_type > to_char_array() const noexcept
Copies the characters in this instance to a Unicode character array.
basic_string quoted() const
Allows insertion and extraction of quoted strings, such as the ones found in CSV or XML.
Definition basic_string.hpp:1610
static int32 compare(const basic_string &str_a, xtd::size index_a, const basic_string &str_b, xtd::size index_b, xtd::size length, xtd::string_comparison comparison_type)
Compares substrings of two specified basic_string objects using the specified rules,...
Definition basic_string.hpp:2111
basic_string< char > to_string() const noexcept override
Converts the value of this instance to a xtd::basic_string <char>.
Definition basic_string.hpp:1919
typename base_type::const_reference const_reference
Represents the basic string const referecne type.
Definition basic_string.hpp:100
basic_string(std::initializer_list< xtd::char32 > il)
Initializes a new instance of xtd::basic_string with specified initializer list.
Definition basic_string.hpp:813
static basic_string join(const basic_string &separator, const collection_t &values, xtd::size index)
Concatenates a specified separator basic_string between each element of a specified object array,...
Definition basic_string.hpp:2313
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:1204
basic_string< xtd::wchar > to_wstring() const noexcept
Converts the value of this instance to a xtd::basic_string <xtd::wchar>.
Definition basic_string.hpp:1961
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:705
basic_string(const xtd::wchar *str, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring and count characters.
Definition basic_string.hpp:643
basic_string(const basic_string< xtd::char8 > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:198
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:1631
basic_string(const basic_string< xtd::wchar > &str, xtd::size index)
Initializes a new instance of xtd::basic_string with specified substring at index.
Definition basic_string.hpp:253
const_iterator begin() const override
Returns an iterator to the first character of the string.
Definition basic_string.hpp:857
friend std::basic_ostream< char > & operator<<(std::basic_ostream< char > &stream, const basic_string &str)
Output stream operator. Behaves as a FormattedOutputFunction. After constructing and checking the sen...
Definition basic_string.hpp:3638
basic_string(const basic_string< xtd::wchar > &str, xtd::size index, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring at index and count character...
Definition basic_string.hpp:359
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:1392
const_iterator end() const override
Returns an iterator to the character following the last character of the string. This character acts ...
Definition basic_string.hpp:908
constexpr basic_string(const string_view_like_t &string_view, size_type index, size_type count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified string view of substring and allocator...
Definition basic_string.hpp:803
basic_string(std::initializer_list< xtd::char32 > il, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified initializer list and allocator.
Definition basic_string.hpp:834
basic_string(const basic_string< xtd::char32 > &str, xtd::size index, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index,...
Definition basic_string.hpp:393
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:1636
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:1537
static basic_string class_name()
Gets the class name of the object_t.
Definition basic_string.hpp:2024
static basic_string class_name(const std::type_info &info)
Gets the class name of the specified object.
Definition basic_string.hpp:2037
const_iterator cend() const override
Returns an iterator to the character following the last character of the string. This character acts ...
Definition basic_string.hpp:887
basic_string(xtd::size count, xtd::wchar character)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:474
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:1380
basic_string trim_start(const xtd::array< value_type > &trim_chars) const noexcept
Removes all leading occurrences of a set of characters specified in an array from the specified xtd::...
basic_string(const basic_string< xtd::wchar > &str) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:168
static bool equals(const basic_string &a, const basic_string &b) noexcept
Determines whether two specified xtd::basic_string objects have the same value.
Definition basic_string.hpp:2229
bool is_empty() const noexcept
Indicates whether this basic_string is an empty basic_string ("").
Definition basic_string.hpp:1511
basic_string(const std::basic_string< char > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:733
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:1216
size_type rfind(value_type ch, size_type pos) const
Finds the last substring that is equal to the given character sequence. The search begins at pos and ...
Definition basic_string.hpp:1712
static int32 compare(const basic_string &str_a, const basic_string &str_b, bool ignore_case) noexcept
Compares two specified basic_string objects, ignoring or honoring their case, and returns an integer ...
Definition basic_string.hpp:2059
static int32 compare(const basic_string &str_a, const basic_string &str_b) noexcept
Compares two specified basic_string objects and returns an integer that indicates their relative posi...
Definition basic_string.hpp:2048
typename xtd::collections::generic::ienumerable< char_t >::iterator iterator
Represents the basic string iterator type.
Definition basic_string.hpp:107
basic_string(const basic_string< xtd::char32 > &str, xtd::size index)
Initializes a new instance of xtd::basic_string with specified substring at index.
Definition basic_string.hpp:233
typename base_type::const_reverse_iterator const_reverse_iterator
Represents the basic string const reverse iterator type.
Definition basic_string.hpp:114
static basic_string concat(const basic_string &str_a, const basic_string &str_b, const basic_string &str_c) noexcept
Concatenates three specified instances of basic_string.
Definition basic_string.hpp:2133
basic_string(const basic_string< xtd::char16 > &str, xtd::size index, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring at index and count character...
Definition basic_string.hpp:327
basic_string(const char *str)
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:532
basic_string(const basic_string< xtd::char16 > &str, xtd::size index, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index and allocator.
Definition basic_string.hpp:274
size_type max_size() const noexcept
Returns the maximum number of elements the string is able to hold due to system or library implementa...
Definition basic_string.hpp:922
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:1615
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:1109
basic_string(const basic_string< xtd::char16 > &str, xtd::size index)
Initializes a new instance of xtd::basic_string with specified substring at index.
Definition basic_string.hpp:224
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:1604
basic_string(xtd::char32 character, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:508
basic_string(const xtd::char8 *str, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring, count characters and alloca...
Definition basic_string.hpp:681
int32 compare(size_type pos1, size_type count1, const basic_string &str, size_type pos2, size_type count2) const
Compares two character sequences.
Definition basic_string.hpp:1034
basic_string(std::initializer_list< char > il)
Initializes a new instance of xtd::basic_string with specified initializer list.
Definition basic_string.hpp:807
static bool equals(const char_a_t *a, const char_b_t *b, bool ignore_case) noexcept
Determines whether two specified xtd::basic_string objects have the same value, ignoring or honoring ...
Definition basic_string.hpp:2252
static basic_string concat(object_a_t obj_a, object_b_t obj_b, object_c_t obj_c) noexcept
Concatenates three specified instances of object.
Definition basic_string.hpp:2140
basic_string(const basic_string< char > &str, xtd::size index, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index and allocator.
Definition basic_string.hpp:264
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:1653
basic_string(const basic_string< xtd::char16 > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:183
xtd::size get_hash_code() const noexcept override
Returns the hash code for this basic_string.
Definition basic_string.hpp:1410
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:1818
typename base_type::size_type size_type
Represents the basic string size type.
Definition basic_string.hpp:94
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:1126
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:1360
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:1278
bool ends_with(value_type value) const noexcept
Determines whether the end of this basic_string matches the specified character.
Definition basic_string.hpp:1154
basic_string(const basic_string< xtd::wchar > &str, xtd::size index, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index and allocator.
Definition basic_string.hpp:306
size_type rfind(value_type ch) const
Finds the last substring that is equal to the given character sequence. The search begins at xtd::bas...
Definition basic_string.hpp:1706
static basic_string concat(const basic_string &str_a, const basic_string &str_b, const basic_string &str_c, const basic_string &str_d) noexcept
Concatenates four specified instances of basic_string.
Definition basic_string.hpp:2119
static basic_string join(const basic_string separator, const collection_t &values) noexcept
Concatenates a specified separator basic_string between each element of a specified object array,...
Definition basic_string.hpp:2296
const_reverse_iterator crend() const
Returns a reverse iterator to the character following the last character of the string....
Definition basic_string.hpp:891
basic_string(xtd::char8 character, xtd::size count)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:513
basic_string(const xtd::wchar *str)
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:562
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:1551
basic_string(const char *str, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified string to copy, and allocator.
Definition basic_string.hpp:571
basic_string & operator=(const basic_string< char > &str) noexcept
Copy assignment operator. Replaces the contents with a copy of the contents of str.
Definition basic_string.hpp:2450
const_reverse_iterator crbegin() const
Returns a reverse iterator to the first character of the string.
Definition basic_string.hpp:879
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:1242
basic_string(const basic_string< xtd::char8 > &str, xtd::size index, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index and allocator.
Definition basic_string.hpp:295
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:1445
basic_string(const basic_string< xtd::char32 > &str, xtd::size index, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index and allocator.
Definition basic_string.hpp:284
const_pointer data() const noexcept
Returns a pointer to the underlying array serving as character storage. The pointer is such that the ...
Definition basic_string.hpp:900
basic_string(basic_string &&)=default
Initializes a new instance of xtd::basic_string with specified string to move.
static constexpr size_type npos
This is a special value equal to the maximum value representable by the type xtd::size.
Definition basic_string.hpp:127
static basic_string concat(const basic_string &str_a, const basic_string &str_b) noexcept
Concatenates two specified instances of basic_string.
Definition basic_string.hpp:2145
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:1184
basic_string trim_end() const noexcept
Removes all trailing occurrences of white-space characters from the specified xtd::basic_string.
Definition basic_string.hpp:1986
xtd::size last_index_of_any(const xtd::array< value_type > &values) const noexcept
Reports the index of the last occurrence in this instance of any character in a specified array of ch...
static bool equals(const char_a_t *a, const char_b_t *b) noexcept
Determines whether two specified xtd::basic_string objects have the same value.
Definition basic_string.hpp:2236
static int32 compare(const basic_string &str_a, xtd::size index_a, const basic_string &str_b, xtd::size index_b, xtd::size length)
Compares substrings of two specified basic_string objects and returns an integer that indicates their...
Definition basic_string.hpp:2083
const_reverse_iterator rend() const
Returns a reverse iterator to the character following the last character of the string....
Definition basic_string.hpp:930
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:141
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:1433
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:1310
basic_string(xtd::char16 character, xtd::size count)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:494
int32 compare(const_pointer s) const
Compares two character sequences.
Definition basic_string.hpp:1053
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:1135
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:1260
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:1292
size_type size() const noexcept
Returns the number of char_t elements in the string, i.e. std::distance(begin(), end()).
Definition basic_string.hpp:934
const_reference at(size_type pos) const
Returns a reference to the character at specified location pos.
Definition basic_string.hpp:943
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:1286
basic_string(const basic_string< char > &str, xtd::size index, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring at index and count character...
Definition basic_string.hpp:317
basic_string substr(size_type pos) const
Returns a substring [pos, pos + count). If the requested substring extends past the end of the string...
Definition basic_string.hpp:1852
basic_string to_title_case() const noexcept
Converts the current basic_string to title case (except for words that are entirely in uppercase,...
basic_string replace(value_type old_char, value_type new_char) const noexcept
Replaces all occurrences of a specified char_t in this basic_string with another specified char_t.
Definition basic_string.hpp:1647
size_type length() const noexcept
Gets the number of characters in the current xtd::basic_string object.
Definition basic_string.hpp:918
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:1171
basic_string(xtd::size count, xtd::char32 character)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:454
basic_string(xtd::size count, xtd::wchar character, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:480
basic_string(const std::basic_string< xtd::char32 > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:747
static basic_string concat(const xtd::array< object_t > &args) noexcept
Concatenates the basic_string representations of the elements in a specified object array.
basic_string(const char *str, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring, count characters and alloca...
Definition basic_string.hpp:653
static bool is_empty(const xtd::basic_string< value_type, traits_type, allocator_type > &string) noexcept
Indicates whether the specifeid basic_string is an empty basic_string ("").
Definition basic_string.hpp:2287
constexpr basic_string(const string_view_like_t &string_view, size_type index, size_type count)
Initializes a new instance of xtd::basic_string with specified string view of substring and allocator...
Definition basic_string.hpp:796
basic_string(xtd::size count, char character, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:441
basic_string(const xtd::char16 *str)
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:539
basic_string & operator+=(const basic_string< char > &str)
Addition assignment operator. Appends additional characters to the string.
Definition basic_string.hpp:2751
typename base_type::value_type value_type
Represents the basic string value type.
Definition basic_string.hpp:90
typename base_type::reverse_iterator reverse_iterator
Represents the basic string reverse iterator type.
Definition basic_string.hpp:112
basic_string(const xtd::char16 *str, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring and count characters.
Definition basic_string.hpp:620
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:1146
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:1597
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:1322
static basic_string full_class_name()
Gets the fully qualified class name of the objec_t, including the namespace of the objec_t.
Definition basic_string.hpp:2269
basic_string(std::initializer_list< xtd::char16 > il)
Initializes a new instance of xtd::basic_string with specified initializer list.
Definition basic_string.hpp:810
basic_string trim_end(value_type trim_char) const noexcept
Removes all trailing occurrences of a character specified from the specified xtd::basic_string .
basic_string(xtd::size count, xtd::char16 character)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:445
int32 compare(size_type pos1, size_type count1, const basic_string &str, size_type pos2) const
Compares two character sequences.
Definition basic_string.hpp:1009
static basic_string concat(value_t value) noexcept
Creates the basic_string representation of a specified object.
Definition basic_string.hpp:2195
xtd::size last_index_of_any(const xtd::array< value_type > &values, xtd::size start_index, xtd::size count) const
Reports the index of the last occurrence in this instance of any character in a specified array of ch...
basic_string(std::initializer_list< xtd::char8 > il)
Initializes a new instance of xtd::basic_string with specified initializer list.
Definition basic_string.hpp:817
static basic_string concat(const xtd::array< basic_string > &values) noexcept
Concatenates the elements of a specified basic_string array.
const_reference front() const
Returns reference to the first character in the string. The behavior is undefined if empty() is true.
Definition basic_string.hpp:913
basic_string trim_start() const noexcept
Removes all leading occurrences of white-space characters from the specified xtd::basic_string.
Definition basic_string.hpp:2002
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:1166
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:1248
basic_string()=default
Initializes a new instance of xtd::basic_string.
basic_string(const basic_string< xtd::char32 > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:190
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:2276
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:1516
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:1590
basic_string(const xtd::char32 *str, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring, count characters and alloca...
Definition basic_string.hpp:671
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:1140
bool starts_with(value_type value) const noexcept
Determines whether the beginning of this instance of xtd::basic_string matches a specified xtd::basic...
Definition basic_string.hpp:1812
const_iterator cbegin() const override
Returns an iterator to the first character of the string.
Definition basic_string.hpp:875
basic_string(xtd::size count, char character)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:436
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:1348
basic_string(const xtd::char8 *str)
Initializes a new instance of xtd::basic_string with specified string to copy.
Definition basic_string.hpp:554
basic_string(std::initializer_list< xtd::char8 > il, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified initializer list and allocator.
Definition basic_string.hpp:839
size_type rfind(const basic_string &str, size_type pos) const
Finds the last substring that is equal to the given character sequence. The search begins at pos and ...
Definition basic_string.hpp:1680
static int32 compare(const basic_string &str_a, xtd::size index_a, const basic_string &str_b, xtd::size index_b, xtd::size length, bool ignore_case)
Compares substrings of two specified basic_string objects, ignoring or honoring their case,...
Definition basic_string.hpp:2097
basic_string(const basic_string< xtd::wchar > &str, xtd::size index, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index,...
Definition basic_string.hpp:417
basic_string trim(const xtd::array< value_type > &trim_chars) const noexcept
Removes all leading and trailing occurrences of a set of characters specified in an array from the sp...
size_type find_last_not_of(const_pointer s, size_type pos) const
Finds the last character equal to none of the characters in the given character sequence....
Definition basic_string.hpp:1387
basic_string< xtd::char8 > to_u8string() const noexcept
Converts the value of this instance to a xtd::basic_string <xtd::char8>.
Definition basic_string.hpp:1945
basic_string(xtd::char32 character, xtd::size count)
Initializes a new instance of xtd::basic_string with specified count copies of character.
Definition basic_string.hpp:503
basic_string(const basic_string< xtd::char8 > &str, xtd::size index, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index,...
Definition basic_string.hpp:405
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:1222
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:1316
int32 compare(const basic_string &str) const
Compares two character sequences.
Definition basic_string.hpp:963
const_pointer c_str() const noexcept
Returns a pointer to a null-terminated character array with data equivalent to those stored in the st...
Definition basic_string.hpp:867
bool empty() const noexcept
Checks if the string has no characters, i.e. whether begin() == end().
Definition basic_string.hpp:904
basic_string(const xtd::wchar *str, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring, count characters and alloca...
Definition basic_string.hpp:691
typename base_type::reference reference
Represents the basic string referecne type.
Definition basic_string.hpp:98
basic_string(std::initializer_list< xtd::wchar > il, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified initializer list and allocator.
Definition basic_string.hpp:844
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:725
basic_string(const xtd::wchar *str, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified string to copy, and allocator.
Definition basic_string.hpp:605
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:1330
basic_string(const std::basic_string< xtd::char8 > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:755
typename xtd::collections::generic::ienumerable< char_t >::const_iterator const_iterator
Represents the basic string const iterator type.
Definition basic_string.hpp:110
constexpr basic_string(const string_view_like_t &string_view, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified string view of substring and allocator...
Definition basic_string.hpp:789
basic_string substr() const
Returns a substring [pos, pos + count). If the requested substring extends past the end of the string...
Definition basic_string.hpp:1846
typename base_type::difference_type difference_type
Represents the basic string difference type.
Definition basic_string.hpp:96
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:1366
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:1190
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:1438
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:711
friend basic_string operator+(const basic_string &lhs, const basic_string< char > &rhs)
Addition operator. Returns a string containing characters from lhs followed by the characters from rh...
Definition basic_string.hpp:2955
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:1266
basic_string(const xtd::char32 *str, xtd::size count)
Initializes a new instance of xtd::basic_string with specified substring and count characters.
Definition basic_string.hpp:627
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:718
basic_string(const basic_string< char > &str, xtd::size index, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index,...
Definition basic_string.hpp:371
bool starts_with(const basic_string &value, bool ignore_case) const noexcept
Determines whether the beginning of this instance of xtd::basic_string matches a specified xtd::basic...
Definition basic_string.hpp:1832
basic_string(const basic_string< xtd::char16 > &str, xtd::size index, xtd::size count, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified substring at index,...
Definition basic_string.hpp:382
basic_string(const std::basic_string< xtd::wchar > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:763
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:1621
basic_string(const basic_string< char > &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::basic_string with specified string to copy and allocator.
Definition basic_string.hpp:176
basic_string< xtd::char16 > to_u16string() const noexcept
Converts the value of this instance to a xtd::basic_string <xtd::char16>.
Definition basic_string.hpp:1930
basic_string(xtd::size count, xtd::char32 character, const allocator_type &allocator)
Initializes a new instance of xtd::basic_string with specified count copies of character and specifie...
Definition basic_string.hpp:459
xtd::array< value_type > to_array() const noexcept
Copies the characters in this instance to a Unicode character array.
basic_string< xtd::char32 > to_u32string() const noexcept
Converts the value of this instance to a xtd::basic_string <xtd::char32>.
Definition basic_string.hpp:1937
const_reference operator[](xtd::size index) const
Returns a reference to the character at specified location index.
Definition basic_string.hpp:2438
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:1543
bool starts_with(const basic_string &value, xtd::string_comparison comparison_type) const noexcept
Determines whether the end of this basic_string matches the specified basic_string when compared usin...
Definition basic_string.hpp:1837
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:1198
size_type capacity() const noexcept
Returns the number of characters that the string has currently allocated space for.
Definition basic_string.hpp:871
const_reference back() const
Returns reference to the last character in the string.
Definition basic_string.hpp:853
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:1211
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:1701
Supports a simple iteration over a generic collection.
Definition enumerator.hpp:31
virtual const_iterator cbegin() const
Returns an iterator to the first element of the enumarable.
Definition enumerable_iterators.hpp:207
virtual const_iterator begin() const
Returns an iterator to the first element of the enumarable.
Definition enumerable_iterators.hpp:200
virtual const_iterator cend() const
Returns an iterator to the element following the last element of the enumarable.
Definition enumerable_iterators.hpp:211
virtual const_iterator end() const
Returns an iterator to the element following the last element of the enumarable.
Definition enumerable_iterators.hpp:215
virtual iterator end()
Returns an iterator to the element following the last element of the enumarable.
Definition enumerable_iterators.hpp:218
virtual iterator begin()
Returns an iterator to the first element of the enumarable.
Definition enumerable_iterators.hpp:203
size_t count() const noexcept
Returns the number of elements in current sequence.
Definition enumerable.hpp:204
Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Definition ienumerable.hpp:36
typename xtd::collections::generic::extensions::enumerable_iterators< type_t, xtd::collections::generic::ienumerable< type_t > >::iterator iterator
Represents the iterator of xtd::collections::generic::ienumerable value type.
Definition ienumerable.hpp:42
typename xtd::collections::generic::extensions::enumerable_iterators< type_t, xtd::collections::generic::ienumerable< type_t > >::const_iterator const_iterator
Represents the const iterator of xtd::collections::generic::ienumerable value type.
Definition ienumerable.hpp:44
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:65
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.hpp:21
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:42
Contains xtd::collections::generic::ienumarable <type_t> interface.
static basic_string sprintf(const basic_string &fmt, args_t &&... args) noexcept
Writes the text representation of the specified arguments list, to basic_string using the specified f...
Definition basic_string.hpp:2414
static basic_string format(const basic_string< char > &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
char8_t char8
Represents a 8-bit unicode character.
Definition char8.hpp:27
wchar_t wchar
Represents a wide character.
Definition wchar.hpp:24
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
null_ptr null
Represents a null pointer value.
char16_t char16
Represents a 16-bit unicode character.
Definition char16.hpp:26
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
char32_t char32
Represents a 32-bit unicode character.
Definition char32.hpp:26
string_comparison
Specifies the culture, case, and sort rules to be used by certain overloads of the xtd::string::compa...
Definition string_comparison.hpp:14
string_split_options
Specifies whether applicable xtd::string::split method overloads include or omit empty substrings fro...
Definition string_split_options.hpp:14
@ ordinal
Compare strings using ordinal (binary) sort rules.
@ ordinal_ignore_case
Compare strings using ordinal (binary) sort rules and ignoring the case of the strings being compared...
@ s
The S key.
@ a
The A key.
@ c
The C key.
@ i
The I key.
@ b
The B key.
@ separator
The Separator key.
@ escape
The ESC (ESCAPE) key.
Contains xtd::hash_code class.
Contains xtd::icomparable interface.
Contains xtd::iequatable interface.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::null pointer valiue.
Contains xtd::object class.
Contains xtd::parse methods.
Contains xtd::string_comparison enum class.
Contains xtd::string_split_options enum class.
Contains xtd::to_string methods.
Contains xtd fundamental types.
Contains unused_ keyword.