4 #define __XTD_CORE_INTERNAL__ 6 #include "internal/__generic_stream_output.h" 7 #include "internal/__format_information.h" 8 #include "internal/__format_stringer.h" 9 #include "internal/__sprintf.h" 10 #undef __XTD_CORE_INTERNAL__ 28 template<
typename ...args_t>
29 void __ustring_extract_format_arg(
xtd::ustring& fmt, std::vector<__format_information<char>>& format, args_t&& ... args);
30 void __throw_ustring_format_exception();
31 void __throw_ustring_format_exception_close_bracket();
32 void __throw_ustring_format_exception_open_bracket();
33 void __throw_ustring_format_exception_start_colon();
63 explicit
ustring(const allocator_type& allocator) noexcept;
69 ustring(
size_t count, value_type character);
75 ustring(
size_t count, value_type character, const allocator_type& allocator);
76 #if defined(__cpp_lib_char8_t) 87 ustring(
size_t count,
char8 character,
const allocator_type& allocator);
99 ustring(
size_t count,
char16 character,
const allocator_type& allocator);
110 ustring(
size_t count,
char32 character,
const allocator_type& allocator);
121 ustring(
size_t count,
wchar character,
const allocator_type& allocator);
133 ustring(
const ustring& str,
size_t index,
size_t count,
const allocator_type& allocator);
142 ustring(
const ustring& str,
size_t index,
const allocator_type& allocator);
146 ustring(
const value_type* str,
size_t count);
151 ustring(
const value_type* str,
size_t count,
const allocator_type& allocator);
154 ustring(
const value_type* str);
158 ustring(
const value_type* str,
const allocator_type& allocator);
165 ustring(value_type* str,
const allocator_type& allocator);
173 ustring(
const ustring& str,
const allocator_type& allocator) noexcept;
177 ustring(
const std::string& str) noexcept;
181 ustring(
const std::string& str,
const allocator_type& allocator) noexcept;
183 #if defined(__cpp_lib_char8_t) 184 ustring(
const std::u8string& str) noexcept;
190 ustring(
const std::u8string& str,
const allocator_type& allocator) noexcept;
197 ustring(
const char8* str,
const allocator_type& allocator);
209 ustring(
const std::u16string& str) noexcept;
213 ustring(
const std::u16string& str,
const allocator_type& allocator) noexcept;
231 ustring(
const std::u32string& str) noexcept;
235 ustring(
const std::u32string& str,
const allocator_type& allocator) noexcept;
253 ustring(
const std::wstring& str) noexcept;
257 ustring(
const std::wstring& str,
const allocator_type& allocator) noexcept;
264 ustring(
const wchar* str,
const allocator_type& allocator);
284 template<
typename input_iterator_t>
285 ustring(input_iterator_t first, input_iterator_t last) : std::basic_string<value_type>(first, last) {}
290 template<
typename input_iterator_t>
291 ustring(input_iterator_t first, input_iterator_t last,
const allocator_type& allocator) : std::basic_string<value_type>(first, last, allocator) {}
296 template<
typename string_view_like_t>
297 explicit constexpr
ustring(
const string_view_like_t& string_view,
const allocator_type& allocator = allocator_type()) : std::basic_string<value_type>(string_view, allocator) {}
304 template<
typename string_view_like_t>
305 constexpr
ustring(
const string_view_like_t& string_view,
size_type index,
size_type count,
const allocator_type& allocator = allocator_type()) : std::basic_string<value_type>(string_view, index, count, allocator) {}
309 ustring(std::initializer_list<value_type> il);
313 ustring(std::initializer_list<value_type> il,
const allocator_type& allocator);
315 #if defined(__cpp_lib_char8_t) 316 ustring(std::initializer_list<char8> il);
322 ustring(std::initializer_list<char8> il,
const allocator_type& allocator);
327 ustring(std::initializer_list<char16> il);
331 ustring(std::initializer_list<char16> il,
const allocator_type& allocator);
335 ustring(std::initializer_list<char32> il);
339 ustring(std::initializer_list<char32> il,
const allocator_type& allocator);
343 ustring(std::initializer_list<wchar> il);
347 ustring(std::initializer_list<wchar> il,
const allocator_type& allocator);
367 ustring& operator =(
const std::string& str) noexcept;
368 ustring& operator =(
const value_type* str);
369 #if defined(__cpp_lib_char8_t) 370 ustring& operator =(
const std::u8string& str) noexcept;
373 ustring& operator =(
const std::u16string& str) noexcept;
375 ustring& operator =(
const std::u32string& str) noexcept;
377 ustring& operator =(
const std::wstring& str) noexcept;
381 ustring& operator =(value_type character);
382 #if defined(__cpp_lib_char8_t) 388 ustring& operator =(
const std::initializer_list<value_type>& il);
389 #if defined(__cpp_lib_char8_t) 390 ustring& operator =(
const std::initializer_list<char8>& il);
392 ustring& operator =(
const std::initializer_list<char16>& il);
393 ustring& operator =(
const std::initializer_list<char32>& il);
394 ustring& operator =(
const std::initializer_list<wchar>& il);
398 template<
typename type_t>
399 ustring operator +(
const type_t&
object)
const {
401 result.append(
object);
405 template<
typename type_t>
406 ustring operator +(
const type_t*
object)
const {
408 result.append(
ustring(
object));
412 template<
typename type_t>
413 ustring operator +(type_t*
object)
const {
415 result.append(
ustring(
object));
420 ustring& operator +=(
const std::string& str);
421 ustring& operator +=(
const value_type* str);
422 #if defined(__cpp_lib_char8_t) 423 ustring& operator +=(
const std::u8string& str);
426 ustring& operator +=(
const std::u16string& str);
428 ustring& operator +=(
const std::u32string& str);
430 ustring& operator +=(
const std::wstring& str);
432 ustring& operator +=(value_type character);
433 #if defined(__cpp_lib_char8_t) 439 ustring& operator +=(
const std::initializer_list<value_type>& il);
440 #if defined(__cpp_lib_char8_t) 441 ustring& operator +=(
const std::initializer_list<char8>& il);
443 ustring& operator +=(
const std::initializer_list<char16>& il);
444 ustring& operator +=(
const std::initializer_list<char32>& il);
445 ustring& operator +=(
const std::initializer_list<wchar>& il);
446 template<
typename type_t>
447 ustring& operator +=(
const type_t&
object) {
448 *
this = *
this +
ustring(
object);
453 bool operator !=(
const ustring& other)
const;
454 bool operator ==(
const std::string& other)
const;
455 bool operator !=(
const std::string& other)
const;
456 bool operator ==(
const value_type* other)
const;
457 bool operator !=(
const value_type* other)
const;
458 #if defined(__cpp_lib_char8_t) 459 bool operator ==(
const std::u8string& other)
const;
460 bool operator !=(
const std::u8string& other)
const;
461 bool operator ==(
const char8* other)
const;
462 bool operator !=(
const char8* other)
const;
464 bool operator ==(
const std::u16string& other)
const;
465 bool operator !=(
const std::u16string& other)
const;
466 bool operator ==(
const char16* other)
const;
467 bool operator !=(
const char16* other)
const;
468 bool operator ==(
const std::u32string& other)
const;
469 bool operator !=(
const std::u32string& other)
const;
470 bool operator ==(
const char32* other)
const;
471 bool operator !=(
const char32* other)
const;
472 bool operator ==(
const std::wstring& other)
const;
473 bool operator !=(
const std::wstring& other)
const;
474 bool operator ==(
const wchar* other)
const;
475 bool operator !=(
const wchar* other)
const;
476 const value_type& operator [](
size_t index);
477 const value_type& operator [](
size_t index)
const;
488 template<
typename object_t>
489 [[deprecated(
"Replaced by typeof_<object_t>().name() - Will be removed in version 0.4.0")]]
496 template<
typename object_t>
497 [[deprecated(
"Replaced by typeof_(object).name() - Will be removed in version 0.4.0")]]
504 [[deprecated(
"Replaced by typeof_(info).name() - Will be removed in version 0.4.0")]]
507 using std::basic_string<value_type>::compare;
567 static int32 compare(
const ustring& str_a,
size_t index_a,
const ustring& str_b,
size_t index_b,
size_t length,
bool ignore_case) noexcept;
599 template<
typename object_a_t,
typename object_b_t,
typename object_c_t,
typename object_d_t>
600 static ustring concat(object_a_t obj_a, object_b_t obj_b, object_c_t obj_c, object_d_t obj_d) noexcept {
601 return format(
"{}{}{}{}", obj_a, obj_b, obj_c, obj_d);
616 template<
typename object_a_t,
typename object_b_t,
typename object_c_t>
617 static ustring concat(object_a_t obj_a, object_b_t obj_b, object_c_t obj_c) noexcept {
618 return format(
"{}{}{}", obj_a, obj_b, obj_c);
631 template<
typename object_a_t,
typename object_b_t>
633 return format(
"{}{}", obj_a, obj_b);
639 static ustring concat(
const std::vector<ustring>& values) noexcept;
642 static ustring concat(
const std::vector<const value_type*>& values) noexcept;
643 #if defined(__cpp_lib_char8_t) 644 static ustring concat(
const std::vector<const char8*>& values) noexcept;
646 static ustring concat(
const std::initializer_list<ustring>& values) noexcept;
647 static ustring concat(
const std::initializer_list<const value_type*>& values) noexcept;
648 #if defined(__cpp_lib_char8_t) 649 static ustring concat(
const std::initializer_list<const char8*>& values) noexcept;
656 template<
typename object_t>
659 for (
const auto& arg : args)
660 result +=
format(
"{}", arg);
665 template<
typename object_t>
666 static ustring concat(
const std::initializer_list<object_t>& args) noexcept {
668 for (
const auto& arg : args)
669 result +=
format(
"{}", arg);
677 template<
typename value_t>
679 return format(
"{}", value);
708 bool equals(
const ustring& tzi)
const noexcept;
713 bool ends_with(value_type value)
const noexcept;
715 #if defined(__cpp_lib_char8_t) 743 template<
typename ...args_t>
747 std::vector<__format_information<char>> formats;
748 auto begin_format_iterator = fmt.end();
749 auto end_format_iterator = fmt.end();
750 for (
auto iterator = fmt.begin(); iterator != fmt.end(); ++iterator) {
751 if (*iterator ==
'{') {
752 if (++iterator == fmt.end())
753 __throw_ustring_format_exception_open_bracket();
754 if (*iterator ==
'{')
757 begin_format_iterator = iterator;
758 while (iterator != fmt.end() && *iterator !=
'}') ++iterator;
759 if (iterator == fmt.end())
760 __throw_ustring_format_exception_open_bracket();
761 end_format_iterator = iterator;
762 __format_information<char> fi;
763 fi.location = result.size();
764 std::string format_str {begin_format_iterator, end_format_iterator};
765 if (format_str.size() == 0)
769 size_t index_format_separator =
ustring(format_str).index_of(
u':');
771 if (index_alignment_separator != std::string::npos && index_format_separator != std::string::npos && index_alignment_separator > index_format_separator)
772 index_alignment_separator = std::string::npos;
774 if (index_alignment_separator != std::string::npos)
775 fi.alignment = format_str.substr(index_alignment_separator + 1, index_format_separator != std::string::npos ? index_format_separator - index_alignment_separator - 1 : std::string::npos);
777 if (index_format_separator != std::string::npos)
778 fi.format = format_str.substr(index_format_separator + 1);
780 if (index_alignment_separator == 0 || index_format_separator == 0)
783 std::string index_str;
784 if (index_alignment_separator != std::string::npos)
785 index_str = format_str.substr(0, index_alignment_separator);
786 else if (index_format_separator != std::string::npos)
787 index_str = format_str.substr(0, index_format_separator);
789 index_str = std::move(format_str);
791 for (
auto c : index_str)
792 if (!std::isdigit(
c)) __throw_ustring_format_exception_start_colon();
793 fi.index = std::stoi(index_str);
795 __throw_ustring_format_exception_start_colon();
799 formats.push_back(fi);
801 }
else if (*iterator ==
'}') {
802 if (++iterator == fmt.end()) {
803 __throw_ustring_format_exception_close_bracket();
806 if (*iterator !=
'}') {
807 __throw_ustring_format_exception_close_bracket();
815 __ustring_extract_format_arg(result, formats, std::forward<args_t>(args)...);
816 return result.c_str();
823 template<
typename object_t>
824 [[deprecated(
"Replaced by typeof_<object_t>().full_name() - Will be removed in version 0.4.0")]]
831 template<
typename object_t>
832 [[deprecated(
"Replaced by typeof_(object).full_name() - Will be removed in version 0.4.0")]]
839 [[deprecated(
"Replaced by typeof_(info).full_name() - Will be removed in version 0.4.0")]]
849 size_t index_of(value_type value)
const noexcept;
860 size_t index_of(value_type value,
size_t start_index)
const noexcept;
866 size_t index_of(
const ustring& value,
size_t start_index)
const noexcept;
873 size_t index_of(value_type value,
size_t start_index,
size_t count)
const noexcept;
880 size_t index_of(
const ustring& value,
size_t start_index,
size_t count)
const noexcept;
885 size_t index_of_any(
const std::vector<value_type>& values)
const noexcept;
891 size_t index_of_any(
const std::vector<value_type>& values,
size_t start_index)
const noexcept;
898 size_t index_of_any(
const std::vector<value_type>& values,
size_t start_index,
size_t count)
const noexcept;
901 size_t index_of_any(
const std::initializer_list<value_type>& values)
const noexcept;
902 size_t index_of_any(
const std::initializer_list<value_type>& values,
size_t start_index)
const noexcept;
903 size_t index_of_any(
const std::initializer_list<value_type>& values,
size_t start_index,
size_t count)
const noexcept;
917 [[deprecated(
"Replaced by xtd::ustring::is_empty(const xtd::ustring&) - Will be removed in version 0.4.0")]]
931 template<
typename collection_t>
941 template<
typename collection_t>
952 template<
typename collection_t>
956 for (
const auto& item : values) {
959 result +=
format(
"{}", item);
961 if (++i >= index + count)
break;
967 template<
typename value_t>
968 static ustring join(
const ustring&
separator,
const std::initializer_list<value_t>& values) noexcept {
return join(separator, std::vector<value_t>(values));}
969 template<
typename value_t>
970 static ustring join(
const ustring& separator,
const std::initializer_list<value_t>& values,
size_t index) noexcept {
return join(separator, std::vector<value_t>(values), index);}
971 template<
typename value_t>
972 static ustring join(
const ustring& separator,
const std::initializer_list<value_t>& values,
size_t index,
size_t count) noexcept {
return join(separator, std::vector<value_t>(values), index, count);}
989 size_t last_index_of(value_type value,
size_t start_index)
const noexcept;
1003 size_t last_index_of(value_type value,
size_t start_index,
size_t count)
const noexcept;
1021 size_t last_index_of_any(
const std::vector<value_type>& values,
size_t start_index)
const noexcept;
1028 size_t last_index_of_any(
const std::vector<value_type>& values,
size_t start_index,
size_t count)
const noexcept;
1031 size_t last_index_of_any(
const std::initializer_list<value_type>& values)
const noexcept;
1032 size_t last_index_of_any(
const std::initializer_list<value_type>& values,
size_t start_index)
const noexcept;
1033 size_t last_index_of_any(
const std::initializer_list<value_type>& values,
size_t start_index,
size_t count)
const noexcept;
1049 ustring pad_left(
size_t total_width, value_type padding_char)
const noexcept;
1064 ustring pad_right(
size_t total_width, value_type padding_char)
const noexcept;
1081 template<
typename value_t>
1083 return xtd::parse<value_t>(str);
1089 ustring remove(
size_t start_index)
const noexcept;
1095 ustring remove(
size_t start_index,
size_t count)
const noexcept;
1101 ustring replace(value_type old_char, value_type new_char)
const noexcept;
1121 std::vector<ustring>
split(
const std::vector<value_type>& separators,
size_t count,
string_split_options options)
const noexcept;
1127 std::vector<ustring>
split()
const noexcept;
1134 std::vector<ustring>
split(
const std::vector<value_type>& separators)
const noexcept;
1162 std::vector<ustring>
split(
const std::vector<value_type>& separators,
size_t count)
const noexcept;
1223 template<
typename ... args_t>
1224 static ustring sprintf(
const ustring& fmt, args_t&& ... args) noexcept {
return __sprintf(fmt.c_str(), convert_param(std::forward<args_t>(args)) ...);}
1230 bool starts_with(value_type value)
const noexcept;
1237 bool starts_with(value_type value,
bool ignore_case)
const noexcept;
1266 std::vector<value_type>
to_array()
const noexcept;
1271 std::vector<value_type>
to_array(
size_t start_index)
const noexcept;
1277 std::vector<value_type>
to_array(
size_t start_index,
size_t length)
const noexcept;
1304 ustring trim(value_type trim_char)
const noexcept;
1310 ustring trim(
const std::vector<value_type>& trim_chars)
const noexcept;
1328 ustring trim_end(
const std::vector<value_type>& trim_chars)
const noexcept;
1352 template<
typename value_t>
1355 value = parse<value_t>(str);
1364 friend std::ostream& operator <<(std::ostream& stream,
const ustring& str) {
return stream << str.c_str();}
1365 friend std::istream& operator >>(std::istream& stream,
ustring& str) {
1374 result.append(str_b);
1378 friend ustring operator +(
const ustring& str_a,
const std::string& str_b) {
1380 result.append(
ustring(str_b));
1384 friend ustring operator +(
const ustring& str_a,
const value_type* str_b) {
1386 result.append(
ustring(str_b));
1390 #if defined(__cpp_lib_char8_t) 1391 friend ustring operator +(
const ustring& str_a,
const std::u8string& str_b) {
1393 result.append(
ustring(str_b));
1399 result.append(
ustring(str_b));
1404 friend ustring operator +(
const ustring& str_a,
const std::u16string& str_b) {
1406 result.append(
ustring(str_b));
1412 result.append(
ustring(str_b));
1416 friend ustring operator +(
const ustring& str_a,
const std::u32string& str_b) {
1418 result.append(
ustring(str_b));
1424 result.append(
ustring(str_b));
1428 friend ustring operator +(
const ustring& str_a,
const std::wstring& str_b) {
1430 result.append(
ustring(str_b));
1436 result.append(
ustring(str_b));
1440 friend ustring operator +(
const ustring& str_a, value_type character) {
1442 result.append(
ustring(1, character));
1446 #if defined(__cpp_lib_char8_t) 1449 result.append(
ustring(1, character));
1456 result.append(
ustring(1, character));
1462 result.append(
ustring(1, character));
1468 result.append(
ustring(1, character));
1472 friend ustring operator +(
const ustring& str_a,
const std::initializer_list<value_type>& il) {
1478 #if defined(__cpp_lib_char8_t) 1479 friend ustring operator +(
const ustring& str_a,
const std::initializer_list<char8>& il) {
1486 friend ustring operator +(
const ustring& str_a,
const std::initializer_list<char16>& il) {
1492 friend ustring operator +(
const ustring& str_a,
const std::initializer_list<char32>& il) {
1498 friend ustring operator +(
const ustring& str_a,
const std::initializer_list<wchar>& il) {
1504 friend ustring operator +(
const std::string& str_a,
const ustring& str_b) {
1506 result.append(str_b);
1510 friend ustring operator +(
const value_type* str_a,
const ustring& str_b) {
1512 result.append(str_b);
1516 #if defined(__cpp_lib_char8_t) 1517 friend ustring operator +(
const std::u8string& str_a,
const ustring& str_b) {
1519 result.append(str_b);
1525 result.append(str_b);
1530 friend ustring operator +(
const std::u16string& str_a,
const ustring& str_b) {
1532 result.append(str_b);
1538 result.append(str_b);
1542 friend ustring operator +(
const std::u32string& str_a,
const ustring& str_b) {
1544 result.append(str_b);
1550 result.append(str_b);
1554 friend ustring operator +(
const std::wstring& str_a,
const ustring& str_b) {
1556 result.append(str_b);
1562 result.append(str_b);
1566 friend ustring operator +(value_type character,
const ustring& str_b) {
1568 result.append(str_b);
1572 #if defined(__cpp_lib_char8_t) 1575 result.append(str_b);
1582 result.append(str_b);
1588 result.append(str_b);
1594 result.append(str_b);
1598 friend ustring operator +(
const std::initializer_list<value_type>& il,
const ustring& str_b) {
1600 result.append(str_b);
1604 #if defined(__cpp_lib_char8_t) 1605 friend ustring operator +(
const std::initializer_list<char8>& il,
const ustring& str_b) {
1607 result.append(str_b);
1612 friend ustring operator +(
const std::initializer_list<char16>& il,
const ustring& str_b) {
1614 result.append(str_b);
1618 friend ustring operator +(
const std::initializer_list<char32>& il,
const ustring& str_b) {
1620 result.append(str_b);
1624 friend ustring operator +(
const std::initializer_list<wchar>& il,
const ustring& str_b) {
1626 result.append(str_b);
1632 template<
typename arg_t>
1633 static auto convert_param(arg_t&& arg) noexcept {
1634 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();
1635 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();
1636 else if constexpr(std::is_same<std::remove_cv_t<std::remove_reference_t<arg_t>>,
xtd::ustring>::value)
return std::forward<arg_t>(arg).c_str();
1637 else return std::forward<arg_t>(arg);
1642 using std::basic_string<value_type>::assign;
1643 using std::basic_string<value_type>::reserve;
1644 using std::basic_string<value_type>::shrink_to_fit;
1645 using std::basic_string<value_type>::clear;
1646 using std::basic_string<value_type>::erase;
1647 using std::basic_string<value_type>::push_back;
1648 using std::basic_string<value_type>::pop_back;
1649 using std::basic_string<value_type>::append;
1650 using std::basic_string<value_type>::replace;
1651 using std::basic_string<value_type>::resize;
1693 template <
typename type_t>
1700 template<
typename arg_t>
1701 void __ustring_extract_format_arg(std::string& fmt,
size_t& index, std::vector<__format_information<char>>& formats, arg_t&& arg) {
1703 for (
auto&
format : formats) {
1704 format.location += offset;
1705 if (
format.index == index) {
1708 if (!
format.alignment.empty()) {
1711 alignment = std::stoi(
format.alignment);
1713 __throw_ustring_format_exception();
1715 if (alignment > 0) arg_str = arg_str.
pad_left(alignment);
1716 else if (alignment < 0) arg_str = arg_str.
pad_right(-alignment);
1719 offset += arg_str.size();
1725 template <
typename ...args_t>
1726 void __xtd_ustrings_unused(args_t&& ... args) {}
1728 template<
typename ...args_t>
1729 void __ustring_extract_format_arg(
xtd::ustring& fmt, std::vector<__format_information<char>>& formats, args_t&& ... args) {
1731 (__ustring_extract_format_arg(fmt, index, formats, args), ...);
1732 __xtd_ustrings_unused(index);
size_t last_index_of(value_type value) const noexcept
Reports the index of the last occurrence of the specified character in this tring.
Contains xtd fundamental types.
static ustring full_class_name(const object_t &object)
Gets the fully qualified class name of the specified object, including the namespace of the specified...
Definition: ustring.h:833
ustring trim_start() const noexcept
Removes all leading occurrences of white-space characters from the specified xtd::ustring.
Contains xtd::iequatable interface.
int32 compare_to(const ustring &tzi) const noexcept override
Compares the current instance with another object of the same type.
ustring trim_end() const noexcept
Removes all trailing occurrences of white-space characters from the specified xtd::ustring.
Contains xtd::icomparable interface.
size_t index_of(value_type value) const noexcept
Reports the index of the first occurrence of the specified character in this string.
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition: icomparable.h:17
static ustring concat(const std::vector< object_t > &args) noexcept
Concatenates the string representations of the elements in a specified object array.
Definition: ustring.h:657
Contains xtd::parse methods.
string_split_options
Specifies whether applicable xtd::ustring::split method overloads include or omit empty substrings fr...
Definition: string_split_options.h:14
ustring pad_right(size_t total_width) const noexcept
Left-aligns the characters in this string, padding with spaces on the right for a specified total len...
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
ustring replace(value_type old_char, value_type new_char) const noexcept
Replaces all occurrences of a specified char_t in this string with another specified char_t...
constexpr ustring(const string_view_like_t &string_view, const allocator_type &allocator=allocator_type())
Initializes a new instance of xtd::ustring with specified string view of substring and allocator...
Definition: ustring.h:297
static ustring join(const ustring &separator, const collection_t &values, size_t index, size_t count) noexcept
Concatenates a specified separator string between each element of a specified Object array...
Definition: ustring.h:953
ustring(input_iterator_t first, input_iterator_t last, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified first and last iterators of substring and a...
Definition: ustring.h:291
string_comparison
Specifies the culture, case, and sort rules to be used by certain overloads of the xtd::ustring::comp...
Definition: string_comparison.h:14
constexpr ustring(const string_view_like_t &string_view, size_type index, size_type count, const allocator_type &allocator=allocator_type())
Initializes a new instance of xtd::ustring with specified string view of substring and allocator...
Definition: ustring.h:305
static ustring concat(object_a_t obj_a, object_b_t obj_b) noexcept
Concatenates two specified instances of object.
Definition: ustring.h:632
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
Contains xtd::to_string methods.
std::string to_string(const date_time &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition: date_time.h:1063
ustring() noexcept
Initializes a new instance of xtd::ustring.
bool ends_with(value_type value) const noexcept
Determines whether the end of this string matches the specified character.
ustring substring(size_t start_index) const noexcept
Retrieves a substring from this instance. The substring starts at a specified character position and ...
bool contains(const ustring &value) const noexcept
Returns a value indicating whether a specified substring occurs within this string.
ustring trim() const noexcept
Removes all leading and trailing occurrences of white-space characters from the specified xtd::ustrin...
static int32 compare(const ustring &str_a, const ustring &str_b) noexcept
Compares two specified string objects and returns an integer that indicates their relative position i...
size_t index_of_any(const std::vector< value_type > &values) const noexcept
Reports the index of the first occurrence in this instance of any character in a specified array of c...
ustring to_lower() const noexcept
Returns a copy of the current string converted to lowercase.
static ustring class_name(const object_t &object)
Gets the class name of the specified object.
Definition: ustring.h:498
static ustring concat(const ustring &str_a, const ustring &str_b, const ustring &str_c, const ustring &str_d) noexcept
Concatenates four specified instances of string.
static value_t parse(const ustring &str)
Converts a string into a value_t type.
Definition: ustring.h:1082
ustring pad_left(size_t total_width) const noexcept
Right-aligns the characters in this string, padding with spaces on the left for a specified total len...
size_t get_hash_code() const noexcept override
Returns the hash code for this string.
ustring insert(size_t start_index, const ustring &value) const noexcept
Inserts a specified instance of string at a specified index position in this instance.
bool is_empty() const noexcept
Indicates whether this string is an empty string ("").
Definition: ustring.h:918
std::vector< ustring > split() const noexcept
Splits this string into substrings that are based on the default white-space characters. White-space characters are defined by the c++ standard and return true if they are passed to the std::isspace() or std::iswspace() method.
ustring(input_iterator_t first, input_iterator_t last)
Initializes a new instance of xtd::ustring with specified first and last iterators of substring...
Definition: ustring.h:285
static ustring concat(object_a_t obj_a, object_b_t obj_b, object_c_t obj_c) noexcept
Concatenates three specified instances of object.
Definition: ustring.h:617
ustring to_upper() const noexcept
Returns a copy of the current string converted to uppercase.
static ustring 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: ustring.h:600
The operating system is other.
bool starts_with(value_type value) const noexcept
Determines whether the beginning of this instance of xtd::ustring matches a specified xtd::ustring...
static bool try_parse(const ustring &str, value_t &value) noexcept
Try to convert a string into a value_t type.
Definition: ustring.h:1353
Contains xtd::object class.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:32
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
Contains xtd::string_split_options enum class.
static ustring class_name()
Gets the class name of the object_t.
Definition: ustring.h:490
size_t last_index_of_any(const std::vector< value_type > &values) const noexcept
Reports the index of the last occurrence in this instance of any character in a specified array of ch...
char32_t char32
Represents a 32-bit unicode character.
Definition: types.h:85
ustring quoted() const
Allows insertion and extraction of quoted strings, such as the ones found in CSV or XML...
static ustring full_class_name()
Gets the fully qualified class name of the objec_t, including the namespace of the objec_t...
Definition: ustring.h:825
static ustring join(const ustring &separator, const collection_t &values, size_t index) noexcept
Concatenates a specified separator string between each element of a specified object array...
Definition: ustring.h:942
std::vector< value_type > to_array() const noexcept
Copies the characters in this instance to a Unicode character array.
static const ustring empty_string
Represents the empty string.
Definition: ustring.h:53
ustring to_string() const noexcept override
Returns a sxd::ustring that represents the current object.
char8_t char8
Represents a 8-bit unicode character.
Definition: types.h:62
ustring to_ustring(int val)
Converts a signed integer to xtd::ustring.
char16_t char16
Represents a 16-bit unicode character.
Definition: types.h:74
static ustring concat(value_t value) noexcept
Creates the string representation of a specified object.
Definition: ustring.h:678
Contains xtd::string_comparison enum class.
static ustring join(const ustring separator, const collection_t &values) noexcept
Concatenates a specified separator string between each element of a specified object array...
Definition: ustring.h:932
ustring to_title_case() const noexcept
Converts the current string to title case (except for words that are entirely in uppercase, which are considered to be acronyms).
static ustring demangle(const ustring &name)
Gets demangled string of name,.
wchar_t wchar
Represents a wide character.
Definition: types.h:284