6 #define __XTD_CORE_INTERNAL__ 7 #include "internal/__generic_stream_output.h" 8 #include "internal/__format_information.h" 9 #include "internal/__format_stringer.h" 10 #include "internal/__sprintf.h" 11 #undef __XTD_CORE_INTERNAL__ 32 template<
typename ...args_t>
33 void __ustring_extract_format_arg(
xtd::ustring& fmt, std::vector<__format_information<char>>& format, args_t&& ... args);
34 void __throw_ustring_format_exception();
35 void __throw_ustring_format_exception_close_bracket();
36 void __throw_ustring_format_exception_open_bracket();
37 void __throw_ustring_format_exception_start_colon();
67 explicit ustring(
const allocator_type& allocator) noexcept;
73 ustring(
size_t count, value_type character);
79 ustring(
size_t count, value_type character,
const allocator_type& allocator);
84 ustring(
size_t count, char8_t character);
90 ustring(
size_t count, char8_t character,
const allocator_type& allocator);
95 ustring(
size_t count, char16_t character);
101 ustring(
size_t count, char16_t character,
const allocator_type& allocator);
106 ustring(
size_t count, char32_t character);
112 ustring(
size_t count, char32_t character,
const allocator_type& allocator);
117 ustring(
size_t count,
wchar_t character);
123 ustring(
size_t count,
wchar_t character,
const allocator_type& allocator);
135 ustring(
const ustring& str,
size_t index,
size_t count,
const allocator_type& allocator);
144 ustring(
const ustring& str,
size_t index,
const allocator_type& allocator);
148 ustring(
const value_type* str,
size_t count);
153 ustring(
const value_type* str,
size_t count,
const allocator_type& allocator);
156 ustring(
const value_type* str);
160 ustring(
const value_type* str,
const allocator_type& allocator);
167 ustring(value_type* str,
const allocator_type& allocator);
175 ustring(
const ustring& str,
const allocator_type& allocator) noexcept;
179 ustring(
const std::string& str) noexcept;
183 ustring(
const std::string& str,
const allocator_type& allocator) noexcept;
187 ustring(
const std::u8string& str) noexcept;
191 ustring(
const std::u8string& str,
const allocator_type& allocator) noexcept;
198 ustring(
const char8_t* str,
const allocator_type& allocator);
205 ustring(char8_t* str,
const allocator_type& allocator);
209 ustring(
const std::u16string& str) noexcept;
213 ustring(
const std::u16string& str,
const allocator_type& allocator) noexcept;
220 ustring(
const char16_t* str,
const allocator_type& allocator);
227 ustring(char16_t* str,
const allocator_type& allocator);
231 ustring(
const std::u32string& str) noexcept;
235 ustring(
const std::u32string& str,
const allocator_type& allocator) noexcept;
242 ustring(
const char32_t* str,
const allocator_type& allocator);
249 ustring(char32_t* str,
const allocator_type& allocator);
253 ustring(
const std::wstring& str) noexcept;
257 ustring(
const std::wstring& str,
const allocator_type& allocator) noexcept;
264 ustring(
const wchar_t* str,
const allocator_type& allocator);
271 ustring(
wchar_t* 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) {}
295 ustring(std::initializer_list<value_type> il);
299 ustring(std::initializer_list<value_type> il,
const allocator_type& allocator);
303 ustring(std::initializer_list<char8_t> il);
307 ustring(std::initializer_list<char8_t> il,
const allocator_type& allocator);
311 ustring(std::initializer_list<char16_t> il);
315 ustring(std::initializer_list<char16_t> il,
const allocator_type& allocator);
319 ustring(std::initializer_list<char32_t> il);
323 ustring(std::initializer_list<char32_t> il,
const allocator_type& allocator);
327 ustring(std::initializer_list<wchar_t> il);
331 ustring(std::initializer_list<wchar_t> il,
const allocator_type& allocator);
351 ustring& operator=(
const std::string& str);
352 ustring& operator=(
const value_type* str);
353 ustring& operator=(
const std::u8string& str);
354 ustring& operator=(
const char8_t* str);
355 ustring& operator=(
const std::u16string& str);
356 ustring& operator=(
const char16_t* str);
357 ustring& operator=(
const std::u32string& str);
358 ustring& operator=(
const char32_t* str);
359 ustring& operator=(
const std::wstring& str);
360 ustring& operator=(
const wchar_t* str);
363 ustring& operator=(value_type character);
364 ustring& operator=(char8_t character);
365 ustring& operator=(char16_t character);
366 ustring& operator=(char32_t character);
367 ustring& operator=(
wchar_t character);
368 ustring& operator=(
const std::initializer_list<value_type>& il);
369 ustring& operator=(
const std::initializer_list<char8_t>& il);
370 ustring& operator=(
const std::initializer_list<char16_t>& il);
371 ustring& operator=(
const std::initializer_list<char32_t>& il);
372 ustring& operator=(
const std::initializer_list<wchar_t>& il);
376 template<
typename type_t>
377 ustring operator+(
const type_t&
object)
const {
379 result.append(
object);
384 ustring& operator+=(
const std::string& str);
385 ustring& operator+=(
const value_type* str);
386 ustring& operator+=(
const std::u8string& str);
387 ustring& operator+=(
const char8_t* str);
388 ustring& operator+=(
const std::u16string& str);
389 ustring& operator+=(
const char16_t* str);
390 ustring& operator+=(
const std::u32string& str);
391 ustring& operator+=(
const char32_t* str);
392 ustring& operator+=(
const std::wstring& str);
393 ustring& operator+=(
const wchar_t* str);
394 ustring& operator+=(value_type character);
395 ustring& operator+=(char8_t character);
396 ustring& operator+=(char16_t character);
397 ustring& operator+=(char32_t character);
398 ustring& operator+=(
wchar_t character);
399 ustring& operator+=(
const std::initializer_list<value_type>& il);
400 ustring& operator+=(
const std::initializer_list<char8_t>& il);
401 ustring& operator+=(
const std::initializer_list<char16_t>& il);
402 ustring& operator+=(
const std::initializer_list<char32_t>& il);
403 ustring& operator+=(
const std::initializer_list<wchar_t>& il);
404 template<
typename type_t>
405 ustring& operator+=(
const type_t&
object) {
406 *
this = *
this +
ustring(
object);
411 bool operator!=(
const ustring& other)
const;
412 bool operator==(
const std::string& other)
const;
413 bool operator!=(
const std::string& other)
const;
414 bool operator==(
const value_type* other)
const;
415 bool operator!=(
const value_type* other)
const;
416 bool operator==(
const std::u8string& other)
const;
417 bool operator!=(
const std::u8string& other)
const;
418 bool operator==(
const char8_t* other)
const;
419 bool operator!=(
const char8_t* other)
const;
420 bool operator==(
const std::u16string& other)
const;
421 bool operator!=(
const std::u16string& other)
const;
422 bool operator==(
const char16_t* other)
const;
423 bool operator!=(
const char16_t* other)
const;
424 bool operator==(
const std::u32string& other)
const;
425 bool operator!=(
const std::u32string& other)
const;
426 bool operator==(
const char32_t* other)
const;
427 bool operator!=(
const char32_t* other)
const;
428 bool operator==(
const std::wstring& other)
const;
429 bool operator!=(
const std::wstring& other)
const;
430 bool operator==(
const wchar_t* other)
const;
431 bool operator!=(
const wchar_t* other)
const;
432 const value_type& operator[](
size_t index);
433 const value_type& operator[](
size_t index)
const;
443 template<
typename object_t>
449 template<
typename object_t>
460 template<
typename object_t>
466 template<
typename object_t>
474 using std::basic_string<value_type>::compare;
520 static int compare(
const ustring& str_a,
size_t index_a,
const ustring& str_b,
size_t index_b,
size_t length) noexcept;
534 static int compare(
const ustring& str_a,
size_t index_a,
const ustring& str_b,
size_t index_b,
size_t length,
bool ignore_case) noexcept;
551 int32_t
compare_to(
const object& obj)
const noexcept
override;
567 template<
typename object_a_t,
typename object_b_t,
typename object_c_t,
typename object_d_t>
568 static ustring concat(object_a_t obj_a, object_b_t obj_b, object_c_t obj_c, object_d_t obj_d) noexcept {
569 return format(
"{}{}{}{}", obj_a, obj_b, obj_c, obj_d);
584 template<
typename object_a_t,
typename object_b_t,
typename object_c_t>
585 static ustring concat(object_a_t obj_a, object_b_t obj_b, object_c_t obj_c) noexcept {
586 return format(
"{}{}{}", obj_a, obj_b, obj_c);
599 template<
typename object_a_t,
typename object_b_t>
601 return format(
"{}{}", obj_a, obj_b);
607 static ustring concat(
const std::vector<ustring>& values) noexcept;
610 static ustring concat(
const std::vector<const value_type*>& values) noexcept;
611 static ustring concat(
const std::vector<const char8_t*>& values) noexcept;
612 static ustring concat(
const std::initializer_list<ustring>& values) noexcept;
613 static ustring concat(
const std::initializer_list<const value_type*>& values) noexcept;
614 static ustring concat(
const std::initializer_list<const char8_t*>& values) noexcept;
620 template<
typename object_t>
623 for (
const auto& arg : args)
624 result +=
format(
"{}", arg);
629 template<
typename object_t>
630 static ustring concat(
const std::initializer_list<object_t>& args) noexcept {
632 for (
const auto& arg : args)
633 result +=
format(
"{}", arg);
641 template<
typename value_t>
643 return format(
"{}", value);
651 for (
auto& item : {
"enum ",
"class ",
"union ",
"struct "})
652 result = result.
replace(item,
"");
655 class auto_delete_char_pointer {
657 auto_delete_char_pointer(
char* value) : value_(value) {}
658 ~auto_delete_char_pointer() {free(value_);}
659 char* operator()()
const {
return value_;}
664 return auto_delete_char_pointer(abi::__cxa_demangle(name.c_str(), 0, 0, &status))();
673 bool equals(
const ustring& tzi)
const noexcept;
674 bool equals(
const object& obj)
const noexcept
override;
679 bool ends_with(value_type value)
const noexcept;
684 bool ends_with(char8_t value)
const noexcept;
707 template<
typename ...args_t>
711 std::vector<__format_information<char>> formats;
712 auto begin_format_iterator = fmt.end();
713 auto end_format_iterator = fmt.end();
714 for (
auto iterator = fmt.begin(); iterator != fmt.end(); ++iterator) {
715 if (*iterator ==
'{') {
716 if (++iterator == fmt.end())
717 __throw_ustring_format_exception_open_bracket();
718 if (*iterator ==
'{')
721 begin_format_iterator = iterator;
722 while (iterator != fmt.end() && *iterator !=
'}') ++iterator;
723 if (iterator == fmt.end())
724 __throw_ustring_format_exception_open_bracket();
725 end_format_iterator = iterator;
726 __format_information<char> fi;
727 fi.location = result.size();
728 std::string format_str {begin_format_iterator, end_format_iterator};
729 if (format_str.size() == 0)
733 size_t index_format_separator =
ustring(format_str).index_of(u8
':');
735 if (index_alignment_separator != std::string::npos && index_format_separator != std::string::npos && index_alignment_separator > index_format_separator)
736 index_alignment_separator = std::string::npos;
738 if (index_alignment_separator != std::string::npos)
739 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);
741 if (index_format_separator != std::string::npos)
742 fi.format = format_str.substr(index_format_separator + 1);
744 if (index_alignment_separator == 0 || index_format_separator == 0)
747 std::string index_str;
748 if (index_alignment_separator != std::string::npos)
749 index_str = format_str.substr(0, index_alignment_separator);
750 else if (index_format_separator != std::string::npos)
751 index_str = format_str.substr(0, index_format_separator);
753 index_str = format_str;
755 for (
auto c : index_str)
756 if (!std::isdigit(
c)) __throw_ustring_format_exception_start_colon();
757 fi.index = std::stoi(index_str);
759 __throw_ustring_format_exception_start_colon();
763 formats.push_back(fi);
765 }
else if (*iterator ==
'}') {
766 if (++iterator == fmt.end())
767 __throw_ustring_format_exception_close_bracket();
768 if (*iterator !=
'}')
769 __throw_ustring_format_exception_close_bracket();
775 __ustring_extract_format_arg(result, formats, std::forward<args_t>(args)...);
776 return result.c_str();
786 size_t index_of(value_type value)
const noexcept;
797 size_t index_of(value_type value,
size_t start_index)
const noexcept;
803 size_t index_of(
const ustring& value,
size_t start_index)
const noexcept;
810 size_t index_of(value_type value,
size_t start_index,
size_t count)
const noexcept;
817 size_t index_of(
const ustring& value,
size_t start_index,
size_t count)
const noexcept;
822 size_t index_of_any(
const std::vector<value_type>& values)
const noexcept;
828 size_t index_of_any(
const std::vector<value_type>& values,
size_t start_index)
const noexcept;
835 size_t index_of_any(
const std::vector<value_type>& values,
size_t start_index,
size_t count)
const noexcept;
838 size_t index_of_any(
const std::initializer_list<value_type>& values)
const noexcept;
839 size_t index_of_any(
const std::initializer_list<value_type>& values,
size_t start_index)
const noexcept;
840 size_t index_of_any(
const std::initializer_list<value_type>& values,
size_t start_index,
size_t count)
const noexcept;
854 [[deprecated(
"Replaced by xtd::ustring::is_empty(const xtd::ustring&) - Will be removed in version 0.4.0")]]
868 template<
typename collection_t>
878 template<
typename collection_t>
889 template<
typename collection_t>
893 for (
const auto& item : values) {
896 result +=
format(
"{}", item);
898 if (++i >= index + count)
break;
904 template<
typename value_t>
905 static ustring join(
const ustring&
separator,
const std::initializer_list<value_t>& values) noexcept {
return join(separator, std::vector<value_t>(values));}
906 template<
typename value_t>
907 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);}
908 template<
typename value_t>
909 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);}
926 size_t last_index_of(value_type value,
size_t start_index)
const noexcept;
940 size_t last_index_of(value_type value,
size_t start_index,
size_t count)
const noexcept;
958 size_t last_index_of_any(
const std::vector<value_type>& values,
size_t start_index)
const noexcept;
965 size_t last_index_of_any(
const std::vector<value_type>& values,
size_t start_index,
size_t count)
const noexcept;
968 size_t last_index_of_any(
const std::initializer_list<value_type>& values)
const noexcept;
969 size_t last_index_of_any(
const std::initializer_list<value_type>& values,
size_t start_index)
const noexcept;
970 size_t last_index_of_any(
const std::initializer_list<value_type>& values,
size_t start_index,
size_t count)
const noexcept;
986 ustring pad_left(
size_t total_width, value_type padding_char)
const noexcept;
1001 ustring pad_right(
size_t total_width, value_type padding_char)
const noexcept;
1006 ustring remove(
size_t start_index)
const noexcept;
1012 ustring remove(
size_t start_index,
size_t count)
const noexcept;
1018 ustring replace(value_type old_char, value_type new_char)
const noexcept;
1038 std::vector<ustring>
split(
const std::vector<value_type>& separators,
size_t count,
string_split_options options)
const noexcept;
1044 std::vector<ustring>
split()
const noexcept;
1051 std::vector<ustring>
split(
const std::vector<value_type>& separators)
const noexcept;
1079 std::vector<ustring>
split(
const std::vector<value_type>& separators,
size_t count)
const noexcept;
1140 template<
typename ... args_t>
1141 static ustring sprintf(
const ustring& fmt, args_t&& ... args) noexcept {
return __sprintf(fmt.c_str(), convert_param(std::forward<args_t>(args)) ...);}
1147 bool starts_with(value_type value)
const noexcept;
1154 bool starts_with(value_type value,
bool ignore_case)
const noexcept;
1183 std::vector<value_type>
to_array()
const noexcept;
1188 std::vector<value_type>
to_array(
size_t start_index)
const noexcept;
1194 std::vector<value_type>
to_array(
size_t start_index,
size_t length)
const noexcept;
1217 ustring trim(value_type trim_char)
const noexcept;
1223 ustring trim(
const std::vector<value_type>& trim_chars)
const noexcept;
1241 ustring trim_end(
const std::vector<value_type>& trim_chars)
const noexcept;
1261 template<
typename value_t>
1263 return xtd::parse<value_t>(str);
1266 template<
typename value_t>
1269 value = parse<value_t>(str);
1278 friend std::ostream& operator<<(std::ostream& stream,
const ustring& str) {
return stream << str.c_str();}
1279 friend std::istream& operator>>(std::istream& stream,
ustring& str) {
1288 result.append(str_b);
1292 friend ustring operator+(
const ustring& str_a,
const std::string& str_b) {
1294 result.append(
ustring(str_b));
1298 friend ustring operator+(
const ustring& str_a,
const value_type* str_b) {
1300 result.append(
ustring(str_b));
1304 friend ustring operator+(
const ustring& str_a,
const std::u8string& str_b) {
1306 result.append(
ustring(str_b));
1310 friend ustring operator+(
const ustring& str_a,
const char8_t* str_b) {
1312 result.append(
ustring(str_b));
1316 friend ustring operator+(
const ustring& str_a,
const std::u16string& str_b) {
1318 result.append(
ustring(str_b));
1322 friend ustring operator+(
const ustring& str_a,
const char16_t* str_b) {
1324 result.append(
ustring(str_b));
1328 friend ustring operator+(
const ustring& str_a,
const std::u32string& str_b) {
1330 result.append(
ustring(str_b));
1334 friend ustring operator+(
const ustring& str_a,
const char32_t* str_b) {
1336 result.append(
ustring(str_b));
1340 friend ustring operator+(
const ustring& str_a,
const std::wstring& str_b) {
1342 result.append(
ustring(str_b));
1346 friend ustring operator+(
const ustring& str_a,
const wchar_t* str_b) {
1348 result.append(
ustring(str_b));
1352 friend ustring operator+(
const ustring& str_a, value_type character) {
1354 result.append(
ustring(1, character));
1358 friend ustring operator+(
const ustring& str_a, char8_t character) {
1360 result.append(
ustring(1, character));
1364 friend ustring operator+(
const ustring& str_a, char16_t character) {
1366 result.append(
ustring(1, character));
1370 friend ustring operator+(
const ustring& str_a, char32_t character) {
1372 result.append(
ustring(1, character));
1376 friend ustring operator+(
const ustring& str_a,
wchar_t character) {
1378 result.append(
ustring(1, character));
1382 friend ustring operator+(
const ustring& str_a,
const std::initializer_list<value_type>& il) {
1388 friend ustring operator+(
const ustring& str_a,
const std::initializer_list<char8_t>& il) {
1394 friend ustring operator+(
const ustring& str_a,
const std::initializer_list<char16_t>& il) {
1400 friend ustring operator+(
const ustring& str_a,
const std::initializer_list<char32_t>& il) {
1406 friend ustring operator+(
const ustring& str_a,
const std::initializer_list<wchar_t>& il) {
1412 friend ustring operator+(
const std::string& str_a,
const ustring& str_b) {
1414 result.append(str_b);
1418 friend ustring operator+(
const value_type* str_a,
const ustring& str_b) {
1420 result.append(str_b);
1424 friend ustring operator+(
const std::u8string& str_a,
const ustring& str_b) {
1426 result.append(str_b);
1430 friend ustring operator+(
const char8_t* str_a,
const ustring& str_b) {
1432 result.append(str_b);
1436 friend ustring operator+(
const std::u16string& str_a,
const ustring& str_b) {
1438 result.append(str_b);
1442 friend ustring operator+(
const char16_t* str_a,
const ustring& str_b) {
1444 result.append(str_b);
1448 friend ustring operator+(
const std::u32string& str_a,
const ustring& str_b) {
1450 result.append(str_b);
1454 friend ustring operator+(
const char32_t* str_a,
const ustring& str_b) {
1456 result.append(str_b);
1460 friend ustring operator+(
const std::wstring& str_a,
const ustring& str_b) {
1462 result.append(str_b);
1466 friend ustring operator+(
const wchar_t* str_a,
const ustring& str_b) {
1468 result.append(str_b);
1472 friend ustring operator+(value_type character,
const ustring& str_b) {
1474 result.append(str_b);
1478 friend ustring operator+(char8_t character,
const ustring& str_b) {
1480 result.append(str_b);
1484 friend ustring operator+(char16_t character,
const ustring& str_b) {
1486 result.append(str_b);
1490 friend ustring operator+(char32_t character,
const ustring& str_b) {
1492 result.append(str_b);
1496 friend ustring operator+(
wchar_t character,
const ustring& str_b) {
1498 result.append(str_b);
1502 friend ustring operator+(
const std::initializer_list<value_type>& il,
const ustring& str_b) {
1504 result.append(str_b);
1508 friend ustring operator+(
const std::initializer_list<char8_t>& il,
const ustring& str_b) {
1510 result.append(str_b);
1514 friend ustring operator+(
const std::initializer_list<char16_t>& il,
const ustring& str_b) {
1516 result.append(str_b);
1520 friend ustring operator+(
const std::initializer_list<char32_t>& il,
const ustring& str_b) {
1522 result.append(str_b);
1526 friend ustring operator+(
const std::initializer_list<wchar_t>& il,
const ustring& str_b) {
1528 result.append(str_b);
1534 template<
typename arg_t>
1535 static auto convert_param(arg_t&& arg) noexcept {
1536 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();
1537 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();
1538 else return std::forward<arg_t>(arg);
1543 using std::basic_string<value_type>::assign;
1544 using std::basic_string<value_type>::reserve;
1545 using std::basic_string<value_type>::shrink_to_fit;
1546 using std::basic_string<value_type>::clear;
1547 using std::basic_string<value_type>::erase;
1548 using std::basic_string<value_type>::push_back;
1549 using std::basic_string<value_type>::pop_back;
1550 using std::basic_string<value_type>::append;
1551 using std::basic_string<value_type>::replace;
1552 using std::basic_string<value_type>::resize;
1594 template <
typename type_t>
1601 template<
typename arg_t>
1602 void __ustring_extract_format_arg(std::string& fmt,
size_t& index, std::vector<__format_information<char>>& formats, arg_t&& arg) {
1604 for (
auto&
format : formats) {
1605 format.location += offset;
1606 if (
format.index == index) {
1609 if (!
format.alignment.empty()) {
1612 alignment = std::stoi(
format.alignment);
1614 __throw_ustring_format_exception();
1616 if (alignment > 0) arg_str = arg_str.
pad_left(alignment);
1617 else if (alignment < 0) arg_str = arg_str.
pad_right(-alignment);
1620 offset += arg_str.size();
1626 template <
typename ...args_t>
1627 void __xtd_ustrings_unused(args_t&& ... args) {}
1629 template<
typename ...args_t>
1630 void __ustring_extract_format_arg(
xtd::ustring& fmt, std::vector<__format_information<char>>& formats, args_t&& ... args) {
1632 (__ustring_extract_format_arg(fmt, index, formats, args), ...);
1633 __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:450
ustring trim_start() const noexcept
Removes all leading occurrences of white-space characters from the specified String.
Contains xtd::iequatable interface.
value_t parse(const std::string &str)
Convert a string into a type.
Definition: parse.h:22
ustring trim_end() const noexcept
Removes all trailing occurrences of white-space characters from the specified String.
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:18
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:621
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:17
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...
bool try_parse(const std::basic_string< char_t > &str, value_t &value)
Convert a string into a type.
Definition: parse.h:399
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:890
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:17
static int 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...
static ustring concat(object_a_t obj_a, object_b_t obj_b) noexcept
Concatenates two specified instances of object.
Definition: ustring.h:600
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:50
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:1110
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.
static ustring class_name(const std::type_info &info)
Gets the class name of the specified object.
Definition: ustring.h:472
ustring trim() const noexcept
Removes all leading and trailing occurrences of white-space characters from the specified String...
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:467
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 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 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: ustring.h:455
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:855
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:585
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:568
The operating system is other.
bool starts_with(value_type value) const noexcept
Determines whether the beginning of this instance of String matches a specified String.
Contains xtd::object class.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:30
Contains xtd::string_split_options enum class.
static ustring class_name()
Gets the class name of the object_t.
Definition: ustring.h:461
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...
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:444
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:879
std::vector< value_type > to_array() const noexcept
Copies the characters in this instance to a Unicode character array.
ustring to_string() const noexcept override
Returns a sxd::ustring that represents the current object.
ustring to_ustring(int val)
Converts a signed integer to xtd::ustring.
static ustring concat(value_t value) noexcept
Creates the string representation of a specified object.
Definition: ustring.h:642
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:869
static ustring demangle(const ustring &name)
Gets demangled string of name,.
Definition: ustring.h:648
int32_t compare_to(const ustring &tzi) const noexcept override
Compares the current instance with another object of the same type.
static ustring empty_string() noexcept
Represents the empty string.