5#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__
29template<
typename ...args_t>
30void __ustring_extract_format_arg(
xtd::ustring& fmt, std::vector<__format_information<char>>& format, args_t&& ... args);
31void __throw_ustring_format_exception(
const char* file,
xtd::uint32 line,
const char* func);
32void __throw_ustring_format_exception_close_bracket(
const char* file,
xtd::uint32 line,
const char* func);
33void __throw_ustring_format_exception_open_bracket(
const char* file,
xtd::uint32 line,
const char* func);
34void __throw_ustring_format_exception_start_colon(
const char* file,
xtd::uint32 line,
const char* func);
64 explicit
ustring(const allocator_type& allocator) noexcept;
70 ustring(
size_t count, value_type character);
76 ustring(
size_t count, value_type character, const allocator_type& allocator);
77#if defined(__cpp_lib_char8_t)
88 ustring(
size_t count,
char8 character,
const allocator_type& allocator);
122 ustring(
size_t count,
wchar character,
const allocator_type& allocator);
134 ustring(
const ustring& str,
size_t index,
size_t count,
const allocator_type& allocator);
152 ustring(
const value_type* str,
size_t count,
const allocator_type& allocator);
159 ustring(
const value_type* str,
const allocator_type& allocator);
166 ustring(value_type* str,
const allocator_type& allocator);
182 ustring(
const std::string& str,
const allocator_type& allocator)
noexcept;
184#if defined(__cpp_lib_char8_t)
191 ustring(
const std::u8string& str,
const allocator_type& allocator)
noexcept;
214 ustring(
const std::u16string& str,
const allocator_type& allocator)
noexcept;
236 ustring(
const std::u32string& str,
const allocator_type& allocator)
noexcept;
258 ustring(
const std::wstring& str,
const allocator_type& allocator)
noexcept;
285 template<
typename input_iterator_t>
286 ustring(input_iterator_t first, input_iterator_t last) : std::basic_string<value_type>(first, last) {}
291 template<
typename input_iterator_t>
292 ustring(input_iterator_t first, input_iterator_t last,
const allocator_type& allocator) : std::basic_string<value_type>(first, last, allocator) {}
297 template<
typename string_view_like_t>
298 explicit constexpr ustring(
const string_view_like_t& string_view,
const allocator_type& allocator = allocator_type()) : std::basic_string<value_type>(string_view, allocator) {}
305 template<
typename string_view_like_t>
306 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) {}
310 ustring(std::initializer_list<value_type> il);
314 ustring(std::initializer_list<value_type> il,
const allocator_type& allocator);
316#if defined(__cpp_lib_char8_t)
323 ustring(std::initializer_list<char8> il,
const allocator_type& allocator);
332 ustring(std::initializer_list<char16> il,
const allocator_type& allocator);
340 ustring(std::initializer_list<char32> il,
const allocator_type& allocator);
348 ustring(std::initializer_list<wchar> il,
const allocator_type& allocator);
368 ustring& operator =(
const std::string& str)
noexcept;
369 ustring& operator =(
const value_type* str);
370#if defined(__cpp_lib_char8_t)
371 ustring& operator =(
const std::u8string& str)
noexcept;
374 ustring& operator =(
const std::u16string& str)
noexcept;
376 ustring& operator =(
const std::u32string& str)
noexcept;
378 ustring& operator =(
const std::wstring& str)
noexcept;
382 ustring& operator =(value_type character);
383#if defined(__cpp_lib_char8_t)
389 ustring& operator =(
const std::initializer_list<value_type>& il);
390#if defined(__cpp_lib_char8_t)
391 ustring& operator =(
const std::initializer_list<char8>& il);
393 ustring& operator =(
const std::initializer_list<char16>& il);
394 ustring& operator =(
const std::initializer_list<char32>& il);
395 ustring& operator =(
const std::initializer_list<wchar>& il);
399 template<
typename type_t>
400 ustring operator +(
const type_t&
object)
const {
402 result.append(
object);
406 template<
typename type_t>
407 ustring operator +(
const type_t*
object)
const {
409 result.append(
ustring(
object));
413 template<
typename type_t>
414 ustring operator +(type_t*
object)
const {
416 result.append(
ustring(
object));
421 ustring& operator +=(
const std::string& str);
422 ustring& operator +=(
const value_type* str);
423#if defined(__cpp_lib_char8_t)
424 ustring& operator +=(
const std::u8string& str);
427 ustring& operator +=(
const std::u16string& str);
429 ustring& operator +=(
const std::u32string& str);
431 ustring& operator +=(
const std::wstring& str);
433 ustring& operator +=(value_type character);
434#if defined(__cpp_lib_char8_t)
440 ustring& operator +=(
const std::initializer_list<value_type>& il);
441#if defined(__cpp_lib_char8_t)
442 ustring& operator +=(
const std::initializer_list<char8>& il);
444 ustring& operator +=(
const std::initializer_list<char16>& il);
445 ustring& operator +=(
const std::initializer_list<char32>& il);
446 ustring& operator +=(
const std::initializer_list<wchar>& il);
447 template<
typename type_t>
448 ustring& operator +=(
const type_t&
object) {
449 *
this = *
this +
ustring(
object);
455 bool operator ==(
const std::string&
other)
const;
456 bool operator !=(
const std::string&
other)
const;
457 bool operator ==(
const value_type*
other)
const;
458 bool operator !=(
const value_type*
other)
const;
459#if defined(__cpp_lib_char8_t)
460 bool operator ==(
const std::u8string&
other)
const;
461 bool operator !=(
const std::u8string&
other)
const;
465 bool operator ==(
const std::u16string&
other)
const;
466 bool operator !=(
const std::u16string&
other)
const;
469 bool operator ==(
const std::u32string&
other)
const;
470 bool operator !=(
const std::u32string&
other)
const;
473 bool operator ==(
const std::wstring&
other)
const;
474 bool operator !=(
const std::wstring&
other)
const;
477 const value_type& operator [](
size_t index);
478 const value_type& operator [](
size_t index)
const;
479 ustring substr(size_type index = 0, size_type count = npos)
const;
492 bool equals(
const ustring& tzi)
const noexcept;
499#if defined(__cpp_lib_char8_t)
539 size_t index_of(value_type value,
size_t start_index) const noexcept;
552 size_t index_of(value_type value,
size_t start_index,
size_t count) const noexcept;
559 size_t index_of(const
ustring& value,
size_t start_index,
size_t count) const noexcept;
564 size_t index_of_any(const std::vector<value_type>& values) const noexcept;
570 size_t index_of_any(const std::vector<value_type>& values,
size_t start_index) const noexcept;
577 size_t index_of_any(const std::vector<value_type>& values,
size_t start_index,
size_t count) const noexcept;
580 size_t index_of_any(const std::initializer_list<value_type>& values) const noexcept;
581 size_t index_of_any(const std::initializer_list<value_type>& values,
size_t start_index) const noexcept;
582 size_t index_of_any(const std::initializer_list<value_type>& values,
size_t start_index,
size_t count) const noexcept;
627 size_t last_index_of(value_type value,
size_t start_index,
size_t count)
const noexcept;
645 size_t last_index_of_any(
const std::vector<value_type>& values,
size_t start_index)
const noexcept;
652 size_t last_index_of_any(
const std::vector<value_type>& values,
size_t start_index,
size_t count)
const noexcept;
655 size_t last_index_of_any(
const std::initializer_list<value_type>& values)
const noexcept;
656 size_t last_index_of_any(
const std::initializer_list<value_type>& values,
size_t start_index)
const noexcept;
657 size_t last_index_of_any(
const std::initializer_list<value_type>& values,
size_t start_index,
size_t count)
const noexcept;
743 std::vector<ustring>
split() const noexcept;
750 std::vector<
ustring>
split(const std::vector<value_type>& separators) const noexcept;
778 std::vector<
ustring>
split(const std::vector<value_type>& separators,
size_t count) const noexcept;
791 bool starts_with(value_type value,
bool ignore_case) const noexcept;
825 std::vector<value_type>
to_array(
size_t start_index) const noexcept;
831 std::vector<value_type>
to_array(
size_t start_index,
size_t length) const noexcept;
864 ustring trim(const std::vector<value_type>& trim_chars) const noexcept;
910 template<typename object_t>
911 [[deprecated("Replaced by
typeof_<object_t>().name() - Will be removed in
version 0.4.0")]]
918 template<
typename object_t>
919 [[deprecated(
"Replaced by typeof_(object).name() - Will be removed in version 0.4.0")]]
926 [[deprecated(
"Replaced by typeof_(info).name() - Will be removed in version 0.4.0")]]
929 using std::basic_string<value_type>
::compare;
1019 template<
typename object_a_t,
typename object_b_t,
typename object_c_t,
typename object_d_t>
1020 static ustring concat(object_a_t obj_a, object_b_t obj_b, object_c_t obj_c, object_d_t obj_d)
noexcept {
1021 return format(
"{}{}{}{}", obj_a, obj_b, obj_c, obj_d);
1036 template<
typename object_a_t,
typename object_b_t,
typename object_c_t>
1037 static ustring concat(object_a_t obj_a, object_b_t obj_b, object_c_t obj_c)
noexcept {
1038 return format(
"{}{}{}", obj_a, obj_b, obj_c);
1051 template<
typename object_a_t,
typename object_b_t>
1053 return format(
"{}{}", obj_a, obj_b);
1062 static ustring concat(
const std::vector<const value_type*>& values)
noexcept;
1063#if defined(__cpp_lib_char8_t)
1064 static ustring concat(
const std::vector<const char8*>& values)
noexcept;
1066 static ustring concat(
const std::initializer_list<ustring>& values)
noexcept;
1067 static ustring concat(
const std::initializer_list<const value_type*>& values)
noexcept;
1068#if defined(__cpp_lib_char8_t)
1069 static ustring concat(
const std::initializer_list<const char8*>& values)
noexcept;
1076 template<
typename object_t>
1079 for (
const auto& arg : args)
1080 result +=
format(
"{}", arg);
1085 template<
typename object_t>
1086 static ustring concat(
const std::initializer_list<object_t>& args)
noexcept {
1088 for (
const auto& arg : args)
1089 result +=
format(
"{}", arg);
1097 template<
typename value_t>
1099 return format(
"{}", value);
1130 template<
typename ...args_t>
1134 std::vector<__format_information<char>> formats;
1135 auto begin_format_iterator = fmt.end();
1136 auto end_format_iterator = fmt.end();
1137 for (
auto iterator = fmt.begin(); iterator != fmt.end(); ++iterator) {
1138 if (*iterator ==
'{') {
1139 if (++iterator == fmt.end())
1140 __throw_ustring_format_exception_open_bracket(__FILE__, __LINE__, __func__);
1141 if (*iterator ==
'{')
1142 result += *iterator;
1144 begin_format_iterator = iterator;
1145 while (iterator != fmt.end() && *iterator !=
'}') ++iterator;
1146 if (iterator == fmt.end())
1147 __throw_ustring_format_exception_open_bracket(__FILE__, __LINE__, __func__);
1148 end_format_iterator = iterator;
1149 __format_information<char> fi;
1150 fi.location = result.size();
1151 std::string format_str {begin_format_iterator, end_format_iterator};
1152 if (format_str.size() == 0)
1155 size_t index_alignment_separator =
ustring(format_str).index_of(
',');
1156 size_t index_format_separator =
ustring(format_str).index_of(
u':');
1158 if (index_alignment_separator != std::string::npos && index_format_separator != std::string::npos && index_alignment_separator > index_format_separator)
1159 index_alignment_separator = std::string::npos;
1161 if (index_alignment_separator != std::string::npos)
1162 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);
1164 if (index_format_separator != std::string::npos)
1165 fi.format = format_str.substr(index_format_separator + 1);
1167 if (index_alignment_separator == 0 || index_format_separator == 0)
1170 std::string index_str;
1171 if (index_alignment_separator != std::string::npos)
1172 index_str = format_str.substr(0, index_alignment_separator);
1173 else if (index_format_separator != std::string::npos)
1174 index_str = format_str.substr(0, index_format_separator);
1176 index_str = std::move(format_str);
1178 for (
auto c : index_str)
1179 if (!std::isdigit(
c)) __throw_ustring_format_exception_start_colon(__FILE__, __LINE__, __func__);
1180 fi.index = std::stoi(index_str);
1182 __throw_ustring_format_exception_start_colon(__FILE__, __LINE__, __func__);
1186 formats.push_back(fi);
1188 }
else if (*iterator ==
'}') {
1189 if (++iterator == fmt.end()) {
1190 __throw_ustring_format_exception_close_bracket(__FILE__, __LINE__, __func__);
1193 if (*iterator !=
'}') {
1194 __throw_ustring_format_exception_close_bracket(__FILE__, __LINE__, __func__);
1197 result += *iterator;
1199 result += *iterator;
1202 __ustring_extract_format_arg(result, formats, std::forward<args_t>(args)...);
1203 return result.c_str();
1210 template<
typename object_t>
1211 [[deprecated(
"Replaced by typeof_<object_t>().full_name() - Will be removed in version 0.4.0")]]
1218 template<
typename object_t>
1219 [[deprecated(
"Replaced by typeof_(object).full_name() - Will be removed in version 0.4.0")]]
1226 [[deprecated(
"Replaced by typeof_(info).full_name() - Will be removed in version 0.4.0")]]
1240 template<
typename collection_t>
1250 template<
typename collection_t>
1261 template<
typename collection_t>
1265 for (
const auto& item : values) {
1268 result +=
format(
"{}", item);
1270 if (++
i >= index + count)
break;
1276 template<
typename value_t>
1278 template<
typename value_t>
1280 template<
typename value_t>
1281 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);}
1287 template<
typename value_t>
1289 return xtd::parse<value_t>(str);
1351 template<
typename ... args_t>
1352 static ustring sprintf(
const ustring& fmt, args_t&& ... args)
noexcept {
return __sprintf(fmt.c_str(), convert_param(std::forward<args_t>(args)) ...);}
1358 template<
typename value_t>
1361 value = parse<value_t>(str);
1370 friend std::ostream& operator <<(std::ostream& stream,
const ustring& str) {
return stream << str.c_str();}
1371 friend std::istream& operator >>(std::istream& stream,
ustring& str) {
1380 result.append(str_b);
1384 friend ustring operator +(
const ustring& str_a,
const std::string& str_b) {
1386 result.append(
ustring(str_b));
1390 friend ustring operator +(
const ustring& str_a,
const value_type* str_b) {
1392 result.append(
ustring(str_b));
1396#if defined(__cpp_lib_char8_t)
1397 friend ustring operator +(
const ustring& str_a,
const std::u8string& str_b) {
1399 result.append(
ustring(str_b));
1405 result.append(
ustring(str_b));
1410 friend ustring operator +(
const ustring& str_a,
const std::u16string& str_b) {
1412 result.append(
ustring(str_b));
1418 result.append(
ustring(str_b));
1422 friend ustring operator +(
const ustring& str_a,
const std::u32string& str_b) {
1424 result.append(
ustring(str_b));
1430 result.append(
ustring(str_b));
1434 friend ustring operator +(
const ustring& str_a,
const std::wstring& str_b) {
1436 result.append(
ustring(str_b));
1442 result.append(
ustring(str_b));
1446 friend ustring operator +(
const ustring& str_a, value_type character) {
1448 result.append(
ustring(1, character));
1452#if defined(__cpp_lib_char8_t)
1455 result.append(
ustring(1, character));
1462 result.append(
ustring(1, character));
1468 result.append(
ustring(1, character));
1474 result.append(
ustring(1, character));
1478 friend ustring operator +(
const ustring& str_a,
const std::initializer_list<value_type>& il) {
1484#if defined(__cpp_lib_char8_t)
1485 friend ustring operator +(
const ustring& str_a,
const std::initializer_list<char8>& il) {
1492 friend ustring operator +(
const ustring& str_a,
const std::initializer_list<char16>& il) {
1498 friend ustring operator +(
const ustring& str_a,
const std::initializer_list<char32>& il) {
1504 friend ustring operator +(
const ustring& str_a,
const std::initializer_list<wchar>& il) {
1510 friend ustring operator +(
const std::string& str_a,
const ustring& str_b) {
1512 result.append(str_b);
1516 friend ustring operator +(
const value_type* str_a,
const ustring& str_b) {
1518 result.append(str_b);
1522#if defined(__cpp_lib_char8_t)
1523 friend ustring operator +(
const std::u8string& str_a,
const ustring& str_b) {
1525 result.append(str_b);
1531 result.append(str_b);
1536 friend ustring operator +(
const std::u16string& str_a,
const ustring& str_b) {
1538 result.append(str_b);
1544 result.append(str_b);
1548 friend ustring operator +(
const std::u32string& str_a,
const ustring& str_b) {
1550 result.append(str_b);
1556 result.append(str_b);
1560 friend ustring operator +(
const std::wstring& str_a,
const ustring& str_b) {
1562 result.append(str_b);
1568 result.append(str_b);
1572 friend ustring operator +(value_type character,
const ustring& str_b) {
1574 result.append(str_b);
1578#if defined(__cpp_lib_char8_t)
1581 result.append(str_b);
1588 result.append(str_b);
1594 result.append(str_b);
1600 result.append(str_b);
1604 friend ustring operator +(
const std::initializer_list<value_type>& il,
const ustring& str_b) {
1606 result.append(str_b);
1610#if defined(__cpp_lib_char8_t)
1611 friend ustring operator +(
const std::initializer_list<char8>& il,
const ustring& str_b) {
1613 result.append(str_b);
1618 friend ustring operator +(
const std::initializer_list<char16>& il,
const ustring& str_b) {
1620 result.append(str_b);
1624 friend ustring operator +(
const std::initializer_list<char32>& il,
const ustring& str_b) {
1626 result.append(str_b);
1630 friend ustring operator +(
const std::initializer_list<wchar>& il,
const ustring& str_b) {
1632 result.append(str_b);
1638 template<
typename arg_t>
1639 static auto convert_param(arg_t&& arg)
noexcept {
1640 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();
1641 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();
1642 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();
1643 else return std::forward<arg_t>(arg);
1648 using std::basic_string<value_type>::assign;
1649 using std::basic_string<value_type>::reserve;
1650 using std::basic_string<value_type>::shrink_to_fit;
1651 using std::basic_string<value_type>
::clear;
1652 using std::basic_string<value_type>::erase;
1653 using std::basic_string<value_type>::push_back;
1654 using std::basic_string<value_type>::pop_back;
1655 using std::basic_string<value_type>::append;
1656 using std::basic_string<value_type>
::replace;
1657 using std::basic_string<value_type>::resize;
1699 template <
typename type_t>
1706template<
typename arg_t>
1707void __ustring_extract_format_arg(std::string& fmt,
size_t& index, std::vector<__format_information<char>>& formats, arg_t&& arg) {
1709 for (
auto& format : formats) {
1710 format.location += offset;
1711 if (format.index == index) {
1714 if (!format.alignment.empty()) {
1717 alignment = std::stoi(format.alignment);
1719 __throw_ustring_format_exception(__FILE__, __LINE__, __func__);
1721 if (alignment > 0) arg_str = arg_str.
pad_left(alignment);
1722 else if (alignment < 0) arg_str = arg_str.
pad_right(-alignment);
1724 fmt.
insert(format.location, arg_str);
1725 offset += arg_str.size();
1731template<
typename ...args_t>
1732void __ustring_extract_format_arg(
xtd::ustring& fmt, std::vector<__format_information<char>>& formats, args_t&& ... args) {
1734 (__ustring_extract_format_arg(fmt, index, formats, args), ...);
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.h:17
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:32
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
ustring(std::initializer_list< value_type > il, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified initializer list and allocator.
ustring remove(size_t start_index, size_t count) const noexcept
Deletes all the characters from this string beginning at a specified position and continuing through ...
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:1037
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:306
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...
ustring(const ustring &str, size_t index, size_t count)
Initializes a new instance of xtd::ustring with specified substring at index and count characters.
ustring(size_t count, char32 character, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified count copies of character and specified all...
ustring(std::initializer_list< char16 > il)
Initializes a new instance of xtd::ustring with specified initializer list.
size_t last_index_of(const ustring &value, size_t start_index) const noexcept
Reports the index of the last occurrence of the specified character in this string....
size_t last_index_of(const ustring &value, size_t start_index, size_t count) const noexcept
Reports the index of the last occurrence of the specified character in this string....
ustring(char32 *str)
Initializes a new instance of xtd::ustring with specified string to copy.
ustring(const char8 *str, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified string to copy, and allocator.
ustring(const value_type *str, size_t count)
Initializes a new instance of xtd::ustring with specified substring and count characters.
int32 compare_to(const ustring &tzi) const noexcept override
Compares the current instance with another object of the same type.
ustring(const char16 *str, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified string to copy, and allocator.
size_t last_index_of(value_type value) const noexcept
Reports the index of the last occurrence of the specified character in this tring.
ustring(const std::u8string &str) noexcept
Initializes a new instance of xtd::ustring with specified string to copy.
bool is_empty() const noexcept
Indicates whether this string is an empty string ("").
Definition ustring.h:597
ustring(const value_type *str)
Initializes a new instance of xtd::ustring with specified string to copy.
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:292
bool ends_with(char8 value) const noexcept
Determines whether the end of this string matches the specified character.
static ustring demangle(const ustring &name)
Gets demangled string of name,.
ustring(std::initializer_list< value_type > il)
Initializes a new instance of xtd::ustring with specified initializer list.
ustring(const std::wstring &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::ustring with specified string to copy and allocator.
size_t last_index_of(value_type value, size_t start_index) const noexcept
Reports the index of the last occurrence of the specified character in this string....
ustring(size_t count, char16 character)
Initializes a new instance of xtd::ustring with specified count copies of character.
ustring quoted() const
Allows insertion and extraction of quoted strings, such as the ones found in CSV or XML.
ustring(std::initializer_list< wchar > il, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified initializer list and allocator.
ustring(char16 *str)
Initializes a new instance of xtd::ustring with specified string to copy.
ustring(const std::u8string &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::ustring with specified string to copy and allocator.
ustring(std::initializer_list< char32 > il)
Initializes a new instance of xtd::ustring with specified initializer list.
static ustring concat(value_t value) noexcept
Creates the string representation of a specified object.
Definition ustring.h:1098
ustring replace(const ustring &old_string, const ustring &new_string) const noexcept
Replaces all occurrences of a specified string in this string with another specified string.
ustring(const ustring &str, size_t index, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified substring at index and allocator.
static int32 compare(const ustring &str_a, const ustring &str_b, xtd::string_comparison comparison_type) noexcept
Compares two specified string objects using the specified rules, and returns an integer that indicate...
ustring pad_left(size_t total_width, value_type padding_char) const noexcept
Right-aligns the characters in this string, padding with spaces on the left for a specified total len...
ustring(const char16 *str)
Initializes a new instance of xtd::ustring with specified string to copy.
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:298
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...
ustring(value_type *str)
Initializes a new instance of xtd::ustring with specified string to copy.
ustring(size_t count, wchar character)
Initializes a new instance of xtd::ustring with specified count copies of character.
ustring to_upper() const noexcept
Returns a copy of the current string converted to uppercase.
static bool is_empty(const xtd::ustring &string) noexcept
Indicates whether the specifeid string is an empty string ("").
ustring(const wchar *str)
Initializes a new instance of xtd::ustring with specified string to copy.
ustring pad_right(size_t total_width, value_type padding_char) const noexcept
Left-aligns the characters in this string, padding with spaces on the right for a specified total len...
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.
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:1262
ustring(ustring &&str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::ustring with specified string to move and allocator.
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(std::initializer_list< char32 > il, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified initializer list and allocator.
std::vector< value_type > to_array() const noexcept
Copies the characters in this instance to a Unicode character array.
ustring(const char32 *str)
Initializes a new instance of xtd::ustring with specified string to copy.
ustring(char32 *str, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified string to copy, and allocator.
static ustring class_name(const object_t &object)
Gets the class name of the specified object.
Definition ustring.h:920
ustring(size_t count, char8 character)
Initializes a new instance of xtd::ustring with specified count copies of character.
ustring trim() const noexcept
Removes all leading and trailing occurrences of white-space characters from the specified xtd::ustrin...
std::vector< ustring > split(const std::vector< value_type > &separators, size_t count, string_split_options options) const noexcept
Splits this string into a maximum number of substrings based on the characters in an array.
std::vector< ustring > split() const noexcept
Splits this string into substrings that are based on the default white-space characters....
ustring(size_t count, char16 character, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified count copies of character and specified all...
ustring trim_end() const noexcept
Removes all trailing occurrences of white-space characters from the 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:1359
ustring(char8 *str, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified string to copy, and allocator.
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:1020
size_t index_of(value_type value) const noexcept
Reports the index of the first occurrence of the specified character in this string.
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...
static ustring class_name(const std::type_info &info)
Gets the class name of the specified object.
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:1077
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:1220
ustring(const value_type *str, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified string to copy, and allocator.
ustring to_title_case() const noexcept
Converts the current string to title case (except for words that are entirely in uppercase,...
ustring trim_start() const noexcept
Removes all leading occurrences of white-space characters from the specified xtd::ustring.
size_t last_index_of(const ustring &value) const noexcept
Reports the index of the last occurrence of the specified string in this string.
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.
bool ends_with(const ustring &value, xtd::string_comparison comparison_type) const noexcept
Determines whether the end of this string matches the specified string when compared using the specif...
static value_t parse(const ustring &str)
Converts a string into a value_t type.
Definition ustring.h:1288
size_t last_index_of_any(const std::vector< value_type > &values, size_t start_index, size_t count) const noexcept
Reports the index of the last occurrence in this instance of any character in a specified array of ch...
ustring(const value_type *str, size_t count, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified substring, count characters and allocator.
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:1241
ustring(const ustring &str, size_t index, size_t count, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified substring at index, count characters and al...
ustring(const ustring &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::ustring with specified string to copy and allocator.
ustring(const std::string &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::ustring with specified string to copy and allocator.
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.
ustring(wchar *str, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified string to copy, and allocator.
ustring(const std::string &str) noexcept
Initializes a new instance of xtd::ustring with specified string to copy.
ustring(value_type *str, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified string to copy, and allocator.
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:1212
static ustring concat(object_a_t obj_a, object_b_t obj_b) noexcept
Concatenates two specified instances of object.
Definition ustring.h:1052
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...
static ustring class_name()
Gets the class name of the object_t.
Definition ustring.h:912
size_t last_index_of(value_type value, size_t start_index, size_t count) const noexcept
Reports the index of the last occurrence of the specified character in this string....
bool ends_with(value_type value) const noexcept
Determines whether the end of this string matches the specified character.
static int32 compare(const ustring &str_a, size_t index_a, const ustring &str_b, size_t index_b, size_t length) noexcept
Compares substrings of two specified string objects and returns an integer that indicates their relat...
ustring(char8 *str)
Initializes a new instance of xtd::ustring with specified string to copy.
size_t get_hash_code() const noexcept override
Returns the hash code for this string.
ustring(const std::u32string &str) noexcept
Initializes a new instance of xtd::ustring with specified string to copy.
ustring(const char32 *str, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified string to copy, and allocator.
ustring(const wchar *str, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified string to copy, and allocator.
ustring(const std::u16string &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::ustring with specified string to copy and allocator.
ustring(const ustring &str, size_t index)
Initializes a new instance of xtd::ustring with specified substring at index.
ustring(const std::wstring &str) noexcept
Initializes a new instance of xtd::ustring with specified string to copy.
ustring remove(size_t start_index) const noexcept
Deletes all the characters from this string beginning at a specified position and continuing through ...
ustring(const ustring &str) noexcept
Initializes a new instance of xtd::ustring with specified string to copy.
static ustring concat(const std::vector< ustring > &values) noexcept
Concatenates the elements of a specified string array.
ustring(ustring &&str) noexcept
Initializes a new instance of xtd::ustring with specified string to move.
static ustring concat(const ustring &str_a, const ustring &str_b, const ustring &str_c) noexcept
Concatenates three specified instances of string.
ustring(size_t count, wchar character, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified count copies of character and specified all...
bool ends_with(const ustring &value) const noexcept
Determines whether the end of this string matches the specified string.
ustring substring(size_t start_index) const noexcept
Retrieves a substring from this instance. The substring starts at a specified character position and ...
static const ustring empty_string
Represents the empty string.
Definition ustring.h:54
ustring(size_t count, char32 character)
Initializes a new instance of xtd::ustring with specified count copies of character.
ustring(std::initializer_list< char8 > il, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified initializer list and allocator.
ustring(char16 *str, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified string to copy, and allocator.
ustring(wchar *str)
Initializes a new instance of xtd::ustring with specified string to copy.
ustring(const std::u32string &str, const allocator_type &allocator) noexcept
Initializes a new instance of xtd::ustring with specified string to copy and allocator.
ustring() noexcept
Initializes a new instance of xtd::ustring.
static int32 compare(const ustring &str_a, const ustring &str_b, bool ignore_case) noexcept
Compares two specified string objects, ignoring or honoring their case, and returns an integer that i...
bool starts_with(value_type value) const noexcept
Determines whether the beginning of this instance of xtd::ustring matches a specified xtd::ustring.
ustring 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...
ustring to_string() const noexcept override
Returns a sxd::ustring that represents the current object.
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:1251
ustring(size_t count, char8 character, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified count copies of character and specified all...
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:286
ustring(const std::u16string &str) noexcept
Initializes a new instance of xtd::ustring with specified string to copy.
ustring(std::initializer_list< wchar > il)
Initializes a new instance of xtd::ustring with specified initializer list.
static ustring concat(const ustring &str_a, const ustring &str_b) noexcept
Concatenates two specified instances of string.
bool ends_with(const ustring &value, bool ignore_case) const noexcept
Determines whether the end of this string instance matches the specified string when compared using t...
bool contains(const ustring &value) const noexcept
Returns a value indicating whether a specified substring occurs within this string.
size_t last_index_of_any(const std::vector< value_type > &values, size_t start_index) const noexcept
Reports the index of the last occurrence in this instance of any character in a specified array of ch...
ustring to_lower() const noexcept
Returns a copy of the current string converted to lowercase.
ustring(const char8 *str)
Initializes a new instance of xtd::ustring with specified string to copy.
ustring(std::initializer_list< char8 > il)
Initializes a new instance of xtd::ustring with specified initializer list.
ustring(std::initializer_list< char16 > il, const allocator_type &allocator)
Initializes a new instance of xtd::ustring with specified initializer list and allocator.
static ustring full_class_name(const std::type_info &info)
Gets the fully qualified class name of the specified object, including the namespace of the specified...
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
Compares substrings of two specified string objects, ignoring or honoring their case,...
static int32 compare(const ustring &str_a, size_t index_a, const ustring &str_b, size_t index_b, size_t length, xtd::string_comparison comparison_type) noexcept
Compares substrings of two specified string objects using the specified rules, and returns an integer...
Represents the version number of an assembly, operating system, or the xtd. This class cannot be inhe...
Definition version.h:110
#define unused_
It may be used to suppress the "unused variable" or "unused local typedefs" compiler warnings when th...
Definition unused.h:30
#define typeof_
Used to obtain the type object of a specified type or object.
Definition typeof.h:45
char8_t char8
Represents a 8-bit unicode character.
Definition types.h:64
wchar_t wchar
Represents a wide character.
Definition types.h:286
char16_t char16
Represents a 16-bit unicode character.
Definition types.h:76
int_least32_t int32
Represents a 32-bit signed integer.
Definition types.h:131
char32_t char32
Represents a 32-bit unicode character.
Definition types.h:87
uint_least32_t uint32
Represents a 32-bit unsigned integer.
Definition types.h:241
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
string_split_options
Specifies whether applicable xtd::ustring::split method overloads include or omit empty substrings fr...
Definition string_split_options.h:14
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:1080
@ other
The operating system is other.
@ separator
The Separator key.
@ insert
The INS (INSERT) key.
@ escape
The ESC (ESCAPE) key.
Contains xtd::icomparable interface.
Contains xtd::iequatable interface.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
ustring to_ustring(int val)
Converts a signed integer to xtd::ustring.
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.