xtd 0.2.0
Loading...
Searching...
No Matches
xtd::ustring Class Reference
Inheritance diagram for xtd::ustring:
xtd::object xtd::icomparable< ustring > xtd::interface

Definition

Represents text as a sequence of UTF-8 code units.

Namespace
xtd
Library
xtd.core
Remarks
A string is a sequential collection of characters that's used to represent text. A xtd::ustring object is a sequential collection of char that represent a string; a char corresponds to a UTF-8 code unit. The value of the xtd::ustring object is the content of the sequential collection of char, and unlike std::basic_string that value is immutable (that is, it is read-only).
If you want the same mutable string class, you can use xtd::text::ustring_builder class.
xtd::ustring is inherited from std::basic_string<char> and therefore offers the full (immutable) API of std::string.
Examples
action.cpp, action1.cpp, action2.cpp, action3.cpp, application_enable_dark_mode.cpp, application_enable_light_mode.cpp, as.cpp, auto_reset_event.cpp, binary_reader.cpp, binary_reader2.cpp, binary_reader3.cpp, boxed_info.cpp, boxing.cpp, console_clear.cpp, console_cursor.cpp, console_firework.cpp, console_read_line.cpp, console_read_line2.cpp, contains.cpp, csf.cpp, current_stack_frame.cpp, date_time_specify_kind.cpp, delegate.cpp, delegate_begin_invoke.cpp, delegate_lambda.cpp, delegate_member_method.cpp, delegate_multicast.cpp, event.cpp, file_info_move_to.cpp, file_info_replace.cpp, folder_browser_box.cpp, folder_browser_dialog.cpp, format_any.cpp, format_class.cpp, format_class_object.cpp, format_class_with_specified_formating.cpp, interface.cpp, interface2.cpp, interlocked.cpp, iobservable_iobserver.cpp, ip_address.cpp, iprogress.cpp, manual_reset_event.cpp, minesweeper.cpp, mixing_std_and_xtd_threads.cpp, open_file_box.cpp, open_file_dialog.cpp, socket_tcp_ip_v4.cpp, socket_tcp_ip_v4_without_thread.cpp, socket_tcp_ip_v6.cpp, socket_udp_ip_v4.cpp, socket_udp_ip_v6.cpp, some_controls.cpp, some_system_controls.cpp, split.cpp, sprintf_class.cpp, sprintf_class_with_specified_formating.cpp, stack_trace_simple.cpp, static.cpp, static_object.cpp, static_object2.cpp, test_forms.cpp, test_tunit.cpp, themes.cpp, time_span_from_hours.cpp, timers_timer_synchronizing_object.cpp, udp_client_ip_v4.cpp, udp_client_ip_v6.cpp, user_dialog.cpp, user_dialog_show_sheet.cpp, wconsole.cpp, and wconsole2.cpp.

Public Fields

static const ustring empty_string
 Represents the empty string.
 

Public Constructors

 ustring () noexcept
 Initializes a new instance of xtd::ustring.
 
 ustring (const allocator_type &allocator) noexcept
 Initializes a new instance of xtd::ustring with specified allocator.
 
 ustring (size_t count, value_type character)
 Initializes a new instance of xtd::ustring with specified count copies of character.
 
 ustring (size_t count, value_type character, const allocator_type &allocator)
 Initializes a new instance of xtd::ustring with specified count copies of character and specified allocator.
 
 ustring (size_t count, char8 character)
 Initializes a new instance of xtd::ustring with specified count copies of character.
 
 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 allocator.
 
 ustring (size_t count, char16 character)
 Initializes a new instance of xtd::ustring with specified count copies of character.
 
 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 allocator.
 
 ustring (size_t count, char32 character)
 Initializes a new instance of xtd::ustring with specified count copies of character.
 
 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 allocator.
 
 ustring (size_t count, wchar character)
 Initializes a new instance of xtd::ustring with specified count copies of character.
 
 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 allocator.
 
 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 (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 allocator.
 
 ustring (const ustring &str, size_t index)
 Initializes a new instance of xtd::ustring with specified substring at index.
 
 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.
 
 ustring (const value_type *str, size_t count)
 Initializes a new instance of xtd::ustring with specified substring and count characters.
 
 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.
 
 ustring (const value_type *str)
 Initializes a new instance of xtd::ustring with specified string to copy.
 
 ustring (const value_type *str, const allocator_type &allocator)
 Initializes a new instance of xtd::ustring with specified string to copy, and allocator.
 
 ustring (value_type *str)
 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.
 
 ustring (const ustring &str) noexcept
 Initializes a new instance of xtd::ustring with specified string to copy.
 
 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) noexcept
 Initializes a new instance of xtd::ustring with specified string to copy.
 
 ustring (const std::string &str, const allocator_type &allocator) noexcept
 Initializes a new instance of xtd::ustring with specified string to copy and allocator.
 
 ustring (const std::u8string &str) noexcept
 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 (const char8 *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 (char8 *str)
 Initializes a new instance of xtd::ustring with specified string to copy.
 
 ustring (char8 *str, const allocator_type &allocator)
 Initializes a new instance of xtd::ustring with specified string to copy, and allocator.
 
 ustring (const std::u16string &str) noexcept
 Initializes a new instance of xtd::ustring with specified string to copy.
 
 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 char16 *str)
 Initializes a new instance of xtd::ustring with specified string to copy.
 
 ustring (const char16 *str, const allocator_type &allocator)
 Initializes a new instance of xtd::ustring with specified string to copy, and allocator.
 
 ustring (char16 *str)
 Initializes a new instance of xtd::ustring with specified string to copy.
 
 ustring (char16 *str, const allocator_type &allocator)
 Initializes a new instance of xtd::ustring with specified string to copy, and allocator.
 
 ustring (const std::u32string &str) noexcept
 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 (const char32 *str)
 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 (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.
 
 ustring (const std::wstring &str) noexcept
 Initializes a new instance of xtd::ustring with specified string to copy.
 
 ustring (const std::wstring &str, const allocator_type &allocator) noexcept
 Initializes a new instance of xtd::ustring with specified string to copy and allocator.
 
 ustring (const wchar *str)
 Initializes a new instance of xtd::ustring with specified string to copy.
 
 ustring (const wchar *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 (wchar *str, const allocator_type &allocator)
 Initializes a new instance of xtd::ustring with specified string to copy, and allocator.
 
 ustring (ustring &&str) noexcept
 Initializes a new instance of xtd::ustring with specified string to move.
 
 ustring (ustring &&str, const allocator_type &allocator) noexcept
 Initializes a new instance of xtd::ustring with specified string to move and allocator.
 
template<typename input_iterator_t >
 ustring (input_iterator_t first, input_iterator_t last)
 Initializes a new instance of xtd::ustring with specified first and last iterators of substring.
 
template<typename input_iterator_t >
 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 allocator.
 
template<typename string_view_like_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.
 
template<typename string_view_like_t >
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.
 
 ustring (std::initializer_list< value_type > il)
 Initializes a new instance of xtd::ustring with specified initializer list.
 
 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 (std::initializer_list< char8 > il)
 Initializes a new instance of xtd::ustring with specified initializer list.
 
 ustring (std::initializer_list< char8 > il, const allocator_type &allocator)
 Initializes a new instance of xtd::ustring with specified initializer list and allocator.
 
 ustring (std::initializer_list< char16 > 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.
 
 ustring (std::initializer_list< char32 > il)
 Initializes a new instance of xtd::ustring with specified initializer list.
 
 ustring (std::initializer_list< char32 > il, const allocator_type &allocator)
 Initializes a new instance of xtd::ustring with specified initializer list and allocator.
 
 ustring (std::initializer_list< wchar > il)
 Initializes a new instance of xtd::ustring with specified initializer list.
 
 ustring (std::initializer_list< wchar > il, const allocator_type &allocator)
 Initializes a new instance of xtd::ustring with specified initializer list and allocator.
 

Public Methods

int32 compare_to (const ustring &tzi) const noexcept override
 Compares the current instance with another object of the same type.
 
bool contains (const ustring &value) const noexcept
 Returns a value indicating whether a specified substring occurs within this string.
 
bool equals (const ustring &tzi) const noexcept
 
bool ends_with (value_type value) const noexcept
 Determines whether the end of this string matches the specified character.
 
bool ends_with (char8 value) const noexcept
 Determines whether the end of this string matches the specified character.
 
bool ends_with (const ustring &value) const noexcept
 Determines whether the end of this string matches the specified 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 the specified culture.
 
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 specified comparison option.
 
size_t get_hash_code () const noexcept override
 Returns the hash code for this string.
 
size_t index_of (value_type value) const noexcept
 Reports the index of the first occurrence of the specified character in this string.
 
size_t index_of (const ustring &value) const noexcept
 Reports the index of the first occurrence of the specified string in this string.
 
size_t index_of (value_type value, size_t start_index) const noexcept
 Reports the index of the first occurrence of the specified character in this string. The search starts at a specified character position.
 
size_t index_of (const ustring &value, size_t start_index) const noexcept
 Reports the index of the first occurrence of the specified character in this string. The search starts at a specified character position.
 
size_t index_of (value_type value, size_t start_index, size_t count) const noexcept
 Reports the index of the first occurrence of the specified character in this string. The search starts at a specified character position and examines a specified number of character positions.
 
size_t index_of (const ustring &value, size_t start_index, size_t count) const noexcept
 Reports the index of the first occurrence of the specified character in this string. The search starts at a specified character position and examines a specified number of character positions.
 
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 characters.
 
size_t index_of_any (const std::vector< value_type > &values, size_t start_index) const noexcept
 Reports the index of the first occurrence in this instance of any character in a specified array of characters. The search starts at a specified character position.
 
size_t index_of_any (const std::vector< value_type > &values, size_t start_index, size_t count) const noexcept
 Reports the index of the first occurrence in this instance of any character in a specified array of characters. The search starts at a specified character position.
 
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 ("").
 
size_t last_index_of (value_type value) const noexcept
 Reports the index of the last occurrence of the specified character in this tring.
 
size_t last_index_of (const ustring &value) const noexcept
 Reports the index of the last occurrence of the specified string in this string.
 
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. The search starts at a specified character position.
 
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. The search starts at a specified character position.
 
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. The search starts at a specified character position and examines a specified number of character positions.
 
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. The search starts at a specified character position and examines a specified number of character positions.
 
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 characters.
 
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 characters. The search starts at a specified character position.
 
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 characters. The search starts at a specified character position.
 
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 length.
 
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 length.
 
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 length.
 
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 length.
 
ustring quoted () const
 Allows insertion and extraction of quoted strings, such as the ones found in CSV or XML.
 
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 delimiter and escape.
 
ustring remove (size_t start_index) const noexcept
 Deletes all the characters from this string beginning at a specified position and continuing through the last position.
 
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 the last position.
 
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.
 
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.
 
std::vector< ustringsplit (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< ustringsplit () 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 xtd::char_object::isspace() or std::iswspace() method.
 
std::vector< ustringsplit (const std::vector< value_type > &separators) const noexcept
 Splits this string into substrings that are based on the characters in an array.
 
std::vector< ustringsplit (const std::vector< value_type > &separators, string_split_options options) const noexcept
 Splits this string into substrings based on the characters in an array. You can specify whether the substrings include empty array elements.
 
std::vector< ustringsplit (const std::vector< value_type > &separators, size_t count) const noexcept
 Splits this string into a maximum number of substrings based on the characters in an array. You also specify the maximum number of substrings to return.
 
bool starts_with (value_type value) const noexcept
 Determines whether the beginning of this instance of xtd::ustring matches a specified xtd::ustring.
 
bool starts_with (value_type value, bool ignore_case) const noexcept
 Determines whether the beginning of this instance of xtd::ustring matches a specified xtd::ustring, ignoring or honoring their case.
 
bool starts_with (const ustring &value) const noexcept
 Determines whether the beginning of this instance of xtd::ustring matches a specified xtd::ustring.
 
bool starts_with (const ustring &value, bool ignore_case) const noexcept
 Determines whether the beginning of this instance of xtd::ustring matches a specified xtd::ustring, ignoring or honoring their case.
 
ustring substring (size_t start_index) const noexcept
 Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length.
 
ustring substring (size_t start_index, size_t length) const noexcept
 Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length.
 
std::vector< value_type > to_array () const noexcept
 Copies the characters in this instance to a Unicode character array.
 
std::vector< value_type > to_array (size_t start_index) const noexcept
 Copies the characters in this instance to a Unicode character array starting at specified index.
 
std::vector< value_type > to_array (size_t start_index, size_t length) const noexcept
 Copies the characters in this instance to a Unicode character array starting at specified index with specified length.
 
ustring to_lower () const noexcept
 Returns a copy of the current string converted to lowercase.
 
ustring to_string () const noexcept override
 Returns a sxd::ustring that represents the current object.
 
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).
 
ustring to_upper () const noexcept
 Returns a copy of the current string converted to uppercase.
 
ustring trim () const noexcept
 Removes all leading and trailing occurrences of white-space characters from the specified xtd::ustring.
 
ustring trim (value_type trim_char) const noexcept
 Removes all leading and trailing occurrences of a character specified from the specified xtd::ustring .
 
ustring trim (const std::vector< value_type > &trim_chars) const noexcept
 Removes all leading and trailing occurrences of a set of characters specified in an array from the specified xtd::ustring.
 
ustring trim_end () const noexcept
 Removes all trailing occurrences of white-space characters from the specified xtd::ustring.
 
ustring trim_end (value_type trim_char) const noexcept
 Removes all trailing occurrences of a character specified from the specified xtd::ustring .
 
ustring trim_end (const std::vector< value_type > &trim_chars) const noexcept
 Removes all trailing occurrences of a set of characters specified in an array from the specified xtd::ustring.
 
ustring trim_start () const noexcept
 Removes all leading occurrences of white-space characters from the specified xtd::ustring.
 
ustring trim_start (value_type trim_char) const noexcept
 Removes all leading occurrences of a character specified from the specified xtd::ustring .
 
ustring trim_start (const std::vector< value_type > &trim_chars) const noexcept
 Removes all leading occurrences of a set of characters specified in an array from the specified xtd::ustring.
 

Public Static Methods

template<typename object_t >
static ustring class_name ()
 Gets the class name of the object_t.
 
template<typename object_t >
static ustring class_name (const object_t &object)
 Gets the class name of the specified object.
 
static ustring class_name (const std::type_info &info)
 Gets the class name of the specified object.
 
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 in the sort order.
 
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 indicates their relative position in the sort order.
 
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 indicates their relative position in the sort order.
 
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 relative position in the sort order.
 
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, and returns an integer that indicates their relative position in the sort order.
 
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 that indicates their relative position in the sort order.
 
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.
 
template<typename object_a_t , typename object_b_t , typename object_c_t , typename object_d_t >
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.
 
static ustring concat (const ustring &str_a, const ustring &str_b, const ustring &str_c) noexcept
 Concatenates three specified instances of string.
 
template<typename object_a_t , typename object_b_t , typename object_c_t >
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.
 
static ustring concat (const ustring &str_a, const ustring &str_b) noexcept
 Concatenates two specified instances of string.
 
template<typename object_a_t , typename object_b_t >
static ustring concat (object_a_t obj_a, object_b_t obj_b) noexcept
 Concatenates two specified instances of object.
 
static ustring concat (const std::vector< ustring > &values) noexcept
 Concatenates the elements of a specified string array.
 
template<typename object_t >
static ustring concat (const std::vector< object_t > &args) noexcept
 Concatenates the string representations of the elements in a specified object array.
 
template<typename value_t >
static ustring concat (value_t value) noexcept
 Creates the string representation of a specified object.
 
static ustring demangle (const ustring &name)
 Gets demangled string of name,.
 
template<typename ... args_t>
static ustring format (const ustring &fmt, args_t &&... args)
 Writes the text representation of the specified arguments list, to string using the specified format information.
 
template<typename object_t >
static ustring full_class_name ()
 Gets the fully qualified class name of the objec_t, including the namespace of the objec_t.
 
template<typename object_t >
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 object.
 
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 object.
 
static bool is_empty (const xtd::ustring &string) noexcept
 Indicates whether the specifeid string is an empty string ("").
 
template<typename collection_t >
static ustring join (const ustring separator, const collection_t &values) noexcept
 Concatenates a specified separator string between each element of a specified object array, yielding a single concatenated string.
 
template<typename collection_t >
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, yielding a single concatenated string.
 
template<typename collection_t >
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, yielding a single concatenated string.
 
template<typename value_t >
static value_t parse (const ustring &str)
 Converts a string into a value_t type.
 
template<typename ... args_t>
static ustring sprintf (const ustring &fmt, args_t &&... args) noexcept
 Writes the text representation of the specified arguments list, to string using the specified format information.
 
template<typename value_t >
static bool try_parse (const ustring &str, value_t &value) noexcept
 Try to convert a string into a value_t type.
 

Additional Inherited Members

- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const noexcept
 Creates a shallow copy of the current object.
 
- Public Member Functions inherited from xtd::icomparable< ustring >
- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

Constructor & Destructor Documentation

◆ ustring() [1/66]

xtd::ustring::ustring ( )
noexcept

Initializes a new instance of xtd::ustring.

◆ ustring() [2/66]

xtd::ustring::ustring ( const allocator_type &  allocator)
explicitnoexcept

Initializes a new instance of xtd::ustring with specified allocator.

Parameters
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [3/66]

xtd::ustring::ustring ( size_t  count,
value_type  character 
)

Initializes a new instance of xtd::ustring with specified count copies of character.

Parameters
strThe string to copy.
countThe number of copies of character.
characterThe character copied.

◆ ustring() [4/66]

xtd::ustring::ustring ( size_t  count,
value_type  character,
const allocator_type &  allocator 
)

Initializes a new instance of xtd::ustring with specified count copies of character and specified allocator.

Parameters
strThe string to copy.
countThe number of copies of character.
characterThe character copied.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [5/66]

xtd::ustring::ustring ( size_t  count,
char8  character 
)

Initializes a new instance of xtd::ustring with specified count copies of character.

Parameters
strThe string to copy.
countThe number of copies of character.
characterThe character copied.

◆ ustring() [6/66]

xtd::ustring::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 allocator.

Parameters
strThe string to copy.
countThe number of copies of character.
characterThe character copied.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [7/66]

xtd::ustring::ustring ( size_t  count,
char16  character 
)

Initializes a new instance of xtd::ustring with specified count copies of character.

Parameters
strThe string to copy.
countThe number of copies of character.
characterThe character copied.

◆ ustring() [8/66]

xtd::ustring::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 allocator.

Parameters
strThe string to copy.
countThe number of copies of character.
characterThe character copied.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [9/66]

xtd::ustring::ustring ( size_t  count,
char32  character 
)

Initializes a new instance of xtd::ustring with specified count copies of character.

Parameters
strThe string to copy.
countThe number of copies of character.
characterThe character copied.

◆ ustring() [10/66]

xtd::ustring::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 allocator.

Parameters
strThe string to copy.
countThe number of copies of character.
characterThe character copied.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [11/66]

xtd::ustring::ustring ( size_t  count,
wchar  character 
)

Initializes a new instance of xtd::ustring with specified count copies of character.

Parameters
strThe string to copy.
countThe number of copies of character.
characterThe character copied.

◆ ustring() [12/66]

xtd::ustring::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 allocator.

Parameters
strThe string to copy.
countThe number of copies of character.
characterThe character copied.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [13/66]

xtd::ustring::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.

Parameters
strThe string to copy.
indexThe index of the first substring character where start copy.
countThe number of substring characters to copy.

◆ ustring() [14/66]

xtd::ustring::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 allocator.

Parameters
strThe string to copy.
indexThe index of the first substring character where start copy.
countThe number of substring characters to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [15/66]

xtd::ustring::ustring ( const ustring str,
size_t  index 
)

Initializes a new instance of xtd::ustring with specified substring at index.

Parameters
strThe string to copy.
indexThe index of the first substring character where start copy.

◆ ustring() [16/66]

xtd::ustring::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.

Parameters
strThe string to copy.
indexThe index of the first substring character where start copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [17/66]

xtd::ustring::ustring ( const value_type *  str,
size_t  count 
)

Initializes a new instance of xtd::ustring with specified substring and count characters.

Parameters
countThe number of substring characters to copy.

◆ ustring() [18/66]

xtd::ustring::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.

Parameters
strThe string to copy.
countThe number of substring characters to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [19/66]

xtd::ustring::ustring ( const value_type *  str)

Initializes a new instance of xtd::ustring with specified string to copy.

◆ ustring() [20/66]

xtd::ustring::ustring ( const value_type *  str,
const allocator_type &  allocator 
)

Initializes a new instance of xtd::ustring with specified string to copy, and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [21/66]

xtd::ustring::ustring ( value_type *  str)

Initializes a new instance of xtd::ustring with specified string to copy.

◆ ustring() [22/66]

xtd::ustring::ustring ( value_type *  str,
const allocator_type &  allocator 
)

Initializes a new instance of xtd::ustring with specified string to copy, and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [23/66]

xtd::ustring::ustring ( const ustring str)
noexcept

Initializes a new instance of xtd::ustring with specified string to copy.

Parameters
strThe string to copy.

◆ ustring() [24/66]

xtd::ustring::ustring ( const ustring str,
const allocator_type &  allocator 
)
noexcept

Initializes a new instance of xtd::ustring with specified string to copy and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [25/66]

xtd::ustring::ustring ( const std::string &  str)
noexcept

Initializes a new instance of xtd::ustring with specified string to copy.

Parameters
strThe string to copy.

◆ ustring() [26/66]

xtd::ustring::ustring ( const std::string &  str,
const allocator_type &  allocator 
)
noexcept

Initializes a new instance of xtd::ustring with specified string to copy and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [27/66]

xtd::ustring::ustring ( const std::u8string &  str)
noexcept

Initializes a new instance of xtd::ustring with specified string to copy.

Parameters
strThe string to copy.

◆ ustring() [28/66]

xtd::ustring::ustring ( const std::u8string &  str,
const allocator_type &  allocator 
)
noexcept

Initializes a new instance of xtd::ustring with specified string to copy and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [29/66]

xtd::ustring::ustring ( const char8 str)

Initializes a new instance of xtd::ustring with specified string to copy.

◆ ustring() [30/66]

xtd::ustring::ustring ( const char8 str,
const allocator_type &  allocator 
)

Initializes a new instance of xtd::ustring with specified string to copy, and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [31/66]

xtd::ustring::ustring ( char8 str)

Initializes a new instance of xtd::ustring with specified string to copy.

◆ ustring() [32/66]

xtd::ustring::ustring ( char8 str,
const allocator_type &  allocator 
)

Initializes a new instance of xtd::ustring with specified string to copy, and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [33/66]

xtd::ustring::ustring ( const std::u16string &  str)
noexcept

Initializes a new instance of xtd::ustring with specified string to copy.

Parameters
strThe string to copy.

◆ ustring() [34/66]

xtd::ustring::ustring ( const std::u16string &  str,
const allocator_type &  allocator 
)
noexcept

Initializes a new instance of xtd::ustring with specified string to copy and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [35/66]

xtd::ustring::ustring ( const char16 str)

Initializes a new instance of xtd::ustring with specified string to copy.

◆ ustring() [36/66]

xtd::ustring::ustring ( const char16 str,
const allocator_type &  allocator 
)

Initializes a new instance of xtd::ustring with specified string to copy, and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [37/66]

xtd::ustring::ustring ( char16 str)

Initializes a new instance of xtd::ustring with specified string to copy.

◆ ustring() [38/66]

xtd::ustring::ustring ( char16 str,
const allocator_type &  allocator 
)

Initializes a new instance of xtd::ustring with specified string to copy, and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [39/66]

xtd::ustring::ustring ( const std::u32string &  str)
noexcept

Initializes a new instance of xtd::ustring with specified string to copy.

Parameters
strThe string to copy.

◆ ustring() [40/66]

xtd::ustring::ustring ( const std::u32string &  str,
const allocator_type &  allocator 
)
noexcept

Initializes a new instance of xtd::ustring with specified string to copy and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [41/66]

xtd::ustring::ustring ( const char32 str)

Initializes a new instance of xtd::ustring with specified string to copy.

◆ ustring() [42/66]

xtd::ustring::ustring ( const char32 str,
const allocator_type &  allocator 
)

Initializes a new instance of xtd::ustring with specified string to copy, and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [43/66]

xtd::ustring::ustring ( char32 str)

Initializes a new instance of xtd::ustring with specified string to copy.

◆ ustring() [44/66]

xtd::ustring::ustring ( char32 str,
const allocator_type &  allocator 
)

Initializes a new instance of xtd::ustring with specified string to copy, and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [45/66]

xtd::ustring::ustring ( const std::wstring &  str)
noexcept

Initializes a new instance of xtd::ustring with specified string to copy.

Parameters
strThe string to copy.

◆ ustring() [46/66]

xtd::ustring::ustring ( const std::wstring &  str,
const allocator_type &  allocator 
)
noexcept

Initializes a new instance of xtd::ustring with specified string to copy and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [47/66]

xtd::ustring::ustring ( const wchar str)

Initializes a new instance of xtd::ustring with specified string to copy.

◆ ustring() [48/66]

xtd::ustring::ustring ( const wchar str,
const allocator_type &  allocator 
)

Initializes a new instance of xtd::ustring with specified string to copy, and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [49/66]

xtd::ustring::ustring ( wchar str)

Initializes a new instance of xtd::ustring with specified string to copy.

◆ ustring() [50/66]

xtd::ustring::ustring ( wchar str,
const allocator_type &  allocator 
)

Initializes a new instance of xtd::ustring with specified string to copy, and allocator.

Parameters
strThe string to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [51/66]

xtd::ustring::ustring ( ustring &&  str)
noexcept

Initializes a new instance of xtd::ustring with specified string to move.

Parameters
strThe string to move.

◆ ustring() [52/66]

xtd::ustring::ustring ( ustring &&  str,
const allocator_type &  allocator 
)
noexcept

Initializes a new instance of xtd::ustring with specified string to move and allocator.

Parameters
strThe string to move.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [53/66]

template<typename input_iterator_t >
xtd::ustring::ustring ( input_iterator_t  first,
input_iterator_t  last 
)
inline

Initializes a new instance of xtd::ustring with specified first and last iterators of substring.

Parameters
firstThe first iterator of substring.
lastThe first iterator of substring.

◆ ustring() [54/66]

template<typename input_iterator_t >
xtd::ustring::ustring ( input_iterator_t  first,
input_iterator_t  last,
const allocator_type &  allocator 
)
inline

Initializes a new instance of xtd::ustring with specified first and last iterators of substring and allocator.

Parameters
firstThe first iterator of substring.
lastThe first iterator of substring.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [55/66]

template<typename string_view_like_t >
constexpr xtd::ustring::ustring ( const string_view_like_t &  string_view,
const allocator_type &  allocator = allocator_type() 
)
inlineexplicitconstexpr

Initializes a new instance of xtd::ustring with specified string view of substring and allocator.

Parameters
string_viewThe string view.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [56/66]

template<typename string_view_like_t >
constexpr xtd::ustring::ustring ( const string_view_like_t &  string_view,
size_type  index,
size_type  count,
const allocator_type &  allocator = allocator_type() 
)
inlineconstexpr

Initializes a new instance of xtd::ustring with specified string view of substring and allocator.

Parameters
string_viewThe string view.
indexThe index of the first substring character where start copy.
countThe number of substring characters to copy.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [57/66]

xtd::ustring::ustring ( std::initializer_list< value_type >  il)

Initializes a new instance of xtd::ustring with specified initializer list.

Parameters
ilThe initializer list to fill.

◆ ustring() [58/66]

xtd::ustring::ustring ( std::initializer_list< value_type >  il,
const allocator_type &  allocator 
)

Initializes a new instance of xtd::ustring with specified initializer list and allocator.

Parameters
ilThe initializer list to fill.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [59/66]

xtd::ustring::ustring ( std::initializer_list< char8 il)

Initializes a new instance of xtd::ustring with specified initializer list.

Parameters
ilThe initializer list to fill.

◆ ustring() [60/66]

xtd::ustring::ustring ( std::initializer_list< char8 il,
const allocator_type &  allocator 
)

Initializes a new instance of xtd::ustring with specified initializer list and allocator.

Parameters
ilThe initializer list to fill.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [61/66]

xtd::ustring::ustring ( std::initializer_list< char16 il)

Initializes a new instance of xtd::ustring with specified initializer list.

Parameters
ilThe initializer list to fill.

◆ ustring() [62/66]

xtd::ustring::ustring ( std::initializer_list< char16 il,
const allocator_type &  allocator 
)

Initializes a new instance of xtd::ustring with specified initializer list and allocator.

Parameters
ilThe initializer list to fill.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [63/66]

xtd::ustring::ustring ( std::initializer_list< char32 il)

Initializes a new instance of xtd::ustring with specified initializer list.

Parameters
ilThe initializer list to fill.

◆ ustring() [64/66]

xtd::ustring::ustring ( std::initializer_list< char32 il,
const allocator_type &  allocator 
)

Initializes a new instance of xtd::ustring with specified initializer list and allocator.

Parameters
ilThe initializer list to fill.
allocatorThe allocator to use for all memory allocations of this string.

◆ ustring() [65/66]

xtd::ustring::ustring ( std::initializer_list< wchar il)

Initializes a new instance of xtd::ustring with specified initializer list.

Parameters
ilThe initializer list to fill.

◆ ustring() [66/66]

xtd::ustring::ustring ( std::initializer_list< wchar il,
const allocator_type &  allocator 
)

Initializes a new instance of xtd::ustring with specified initializer list and allocator.

Parameters
ilThe initializer list to fill.
allocatorThe allocator to use for all memory allocations of this string.

Member Function Documentation

◆ class_name() [1/3]

template<typename object_t >
static ustring xtd::ustring::class_name ( )
inlinestatic

Gets the class name of the object_t.

Returns
The class name of the object_t.
Remarks
For example, the name of the ustring type is ustring.
Deprecated:
Replaced by typeof_<object_t>().name() - Will be removed in version 0.4.0

◆ class_name() [2/3]

template<typename object_t >
static ustring xtd::ustring::class_name ( const object_t &  object)
inlinestatic

Gets the class name of the specified object.

Returns
The class name of the specified object.
Remarks
For example, the name of the ustring type is ustring.
Deprecated:
Replaced by typeof_(object).name() - Will be removed in version 0.4.0

◆ class_name() [3/3]

static ustring xtd::ustring::class_name ( const std::type_info &  info)
static

Gets the class name of the specified object.

Returns
The class name of the specified object.
Remarks
For example, the name of the ustring type is ustring.
Deprecated:
Replaced by typeof_(info).name() - Will be removed in version 0.4.0

◆ compare() [1/6]

static int32 xtd::ustring::compare ( const ustring str_a,
const ustring str_b 
)
staticnoexcept

Compares two specified string objects and returns an integer that indicates their relative position in the sort order.

Parameters
str_aThe first string to compare.
str_bThe second string to compare.
Returns
A 32-bit signed integer that indicates the lexical relationship between the two compares.
Value Condition
Less than zero str_a precedes str_b in the sort order.
Zero str_a occurs in the same position as str_b in the sort order.
Greater than zero str_a follows str_b in the sort order.

◆ compare() [2/6]

static int32 xtd::ustring::compare ( const ustring str_a,
const ustring str_b,
bool  ignore_case 
)
staticnoexcept

Compares two specified string objects, ignoring or honoring their case, and returns an integer that indicates their relative position in the sort order.

Parameters
str_aThe first string to compare.
str_bThe second string to compare.
ignore_casetrue to ignore case during the comparison; otherwise, false.
Returns
A 32-bit signed integer that indicates the lexical relationship between the two compares.
Value Condition
Less than zero str_a precedes str_b in the sort order.
Zero str_a occurs in the same position as str_b in the sort order.
Greater than zero str_a follows str_b in the sort order.

◆ compare() [3/6]

static int32 xtd::ustring::compare ( const ustring str_a,
const ustring str_b,
xtd::string_comparison  comparison_type 
)
staticnoexcept

Compares two specified string objects using the specified rules, and returns an integer that indicates their relative position in the sort order.

Parameters
str_aThe first string to compare.
str_bThe second string to compare.
comparison_typeOne of the enumeration values that specifies the rules to use in the comparison.
Returns
A 32-bit signed integer that indicates the lexical relationship between the two compares.
Value Condition
Less than zero str_a precedes str_b in the sort order.
Zero str_a occurs in the same position as str_b in the sort order.
Greater than zero str_a follows str_b in the sort order.

◆ compare() [4/6]

static int32 xtd::ustring::compare ( const ustring str_a,
size_t  index_a,
const ustring str_b,
size_t  index_b,
size_t  length 
)
staticnoexcept

Compares substrings of two specified string objects and returns an integer that indicates their relative position in the sort order.

Parameters
str_aThe first string to use in the comparison.
index_aThe position of the substring within str_a.
str_bThe second string to use in the comparison.
index_bThe position of the substring within str_b.
lengthThe maximum number of characters in the substrings to compare
Returns
A 32-bit signed integer that indicates the lexical relationship between the two compares.
Value Condition
Less than zero str_a precedes str_b in the sort order.
Zero str_a occurs in the same position as str_b in the sort order.
Greater than zero str_a follows str_b in the sort order.

◆ compare() [5/6]

static int32 xtd::ustring::compare ( const ustring str_a,
size_t  index_a,
const ustring str_b,
size_t  index_b,
size_t  length,
bool  ignore_case 
)
staticnoexcept

Compares substrings of two specified string objects, ignoring or honoring their case, and returns an integer that indicates their relative position in the sort order.

Parameters
str_aThe first string to use in the comparison.
index_aThe position of the substring within str_a.
str_bThe second string to use in the comparison.
index_bThe position of the substring within str_b.
lengthThe maximum number of characters in the substrings to compare
ignore_casetrue to ignore case during the comparison; otherwise, false.
Returns
A 32-bit signed integer that indicates the lexical relationship between the two compares.
Value Condition
Less than zero str_a precedes str_b in the sort order.
Zero str_a occurs in the same position as str_b in the sort order.
Greater than zero str_a follows str_b in the sort order.

◆ compare() [6/6]

static int32 xtd::ustring::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 
)
staticnoexcept

Compares substrings of two specified string objects using the specified rules, and returns an integer that indicates their relative position in the sort order.

Parameters
str_aThe first string to use in the comparison.
index_aThe position of the substring within str_a.
str_bThe second string to use in the comparison.
index_bThe position of the substring within str_b.
lengthThe maximum number of characters in the substrings to compare
comparison_typeOne of the enumeration values that specifies the rules to use in the comparison.
Returns
A 32-bit signed integer that indicates the lexical relationship between the two compares.
Value Condition
Less than zero str_a precedes str_b in the sort order.
Zero str_a occurs in the same position as str_b in the sort order.
Greater than zero str_a follows str_b in the sort order.

◆ compare_to()

int32 xtd::ustring::compare_to ( const ustring obj) const
overridevirtualnoexcept

Compares the current instance with another object of the same type.

Parameters
objAn object to compare with this instance.
Returns
A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings:
Value Condition
Less than zero This instance is less than obj.
Zero This instance is equal to obj.
Greater than zero This instance is greater than obj.

Implements xtd::icomparable< ustring >.

◆ concat() [1/9]

template<typename object_t >
static ustring xtd::ustring::concat ( const std::vector< object_t > &  args)
inlinestaticnoexcept

Concatenates the string representations of the elements in a specified object array.

Parameters
argsAn object array that contains the elements to concatenate.
Returns
The concatenated string representations of the values of the elements in args.

◆ concat() [2/9]

static ustring xtd::ustring::concat ( const std::vector< ustring > &  values)
staticnoexcept

Concatenates the elements of a specified string array.

Parameters
valuesAn array of string instances.
Returns
The concatenated elements of values.

◆ concat() [3/9]

static ustring xtd::ustring::concat ( const ustring str_a,
const ustring str_b 
)
staticnoexcept

Concatenates two specified instances of string.

Parameters
str_aThe first string to concatenate.
str_bThe second string to concatenate.
Returns
string The concatenation of str_a and str_b.

◆ concat() [4/9]

static ustring xtd::ustring::concat ( const ustring str_a,
const ustring str_b,
const ustring str_c 
)
staticnoexcept

Concatenates three specified instances of string.

Parameters
str_aThe first string to concatenate.
str_bThe second string to concatenate.
str_cThe third string to concatenate.
Returns
string The concatenation of str_a, str_b and str_c.

◆ concat() [5/9]

static ustring xtd::ustring::concat ( const ustring str_a,
const ustring str_b,
const ustring str_c,
const ustring str_d 
)
staticnoexcept

Concatenates four specified instances of string.

Parameters
str_aThe first string to concatenate.
str_bThe second string to concatenate.
str_cThe third string to concatenate.
str_dThe fourth string to concatenate.
Returns
The concatenation of str_a, str_b, str_c and str_d.

◆ concat() [6/9]

template<typename object_a_t , typename object_b_t >
static ustring xtd::ustring::concat ( object_a_t  obj_a,
object_b_t  obj_b 
)
inlinestaticnoexcept

Concatenates two specified instances of object.

Parameters
obj_aThe first object to concatenate.
obj_bThe second object to concatenate.
Returns
The concatenation of obj_a and obj_b.

◆ concat() [7/9]

template<typename object_a_t , typename object_b_t , typename object_c_t >
static ustring xtd::ustring::concat ( object_a_t  obj_a,
object_b_t  obj_b,
object_c_t  obj_c 
)
inlinestaticnoexcept

Concatenates three specified instances of object.

Parameters
obj_aThe first object to concatenate.
obj_bThe second object to concatenate.
obj_cThe third object to concatenate.
Returns
The concatenation of obj_a, obj_b and obj_c.

◆ concat() [8/9]

template<typename object_a_t , typename object_b_t , typename object_c_t , typename object_d_t >
static ustring xtd::ustring::concat ( object_a_t  obj_a,
object_b_t  obj_b,
object_c_t  obj_c,
object_d_t  obj_d 
)
inlinestaticnoexcept

Concatenates four specified instances of object.

Parameters
obj_aThe first object to concatenate.
obj_bThe second object to concatenate.
obj_cThe third object to concatenate.
obj_dThe fourth object to concatenate.
Returns
The concatenation of obj_a, obj_b, obj_c and obj_d.

◆ concat() [9/9]

template<typename value_t >
static ustring xtd::ustring::concat ( value_t  value)
inlinestaticnoexcept

Creates the string representation of a specified object.

Parameters
valueThe object to represent.
Returns
The string representation of the value of arg.

◆ contains()

bool xtd::ustring::contains ( const ustring value) const
noexcept

Returns a value indicating whether a specified substring occurs within this string.

Parameters
valueThe string to seek.
Returns
true if the value parameter occurs within this string, or if value is the empty string (""); otherwise, false.

◆ demangle()

static ustring xtd::ustring::demangle ( const ustring name)
static

Gets demangled string of name,.

Parameters
nameThe name to demangle.
Returns
The demangled string of name.
Examples
The following example shows how to use xtd::ustring::demangle.
#include <xtd/xtd>
using namespace xtd;
auto main()->int {
console::write_line("name = {}", typeid(xtd::date_time).name());
console::write_line("demangled name = {}", ustring::demangle(typeid(xtd::date_time).name()));
}
// This code produces the following output on macOS :
//
// name = N3xtd9date_timeE
// demangled name = xtd::date_time
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
Represents an instant in time, typically expressed as a date and time of day.
Definition date_time.h:79
static ustring demangle(const ustring &name)
Gets demangled string of name,.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10

◆ ends_with() [1/5]

bool xtd::ustring::ends_with ( char8  value) const
noexcept

Determines whether the end of this string matches the specified character.

Parameters
valueThe char_t to compare to the substring at the end of this instance.
Returns
true if value matches the end of this instance; otherwise, false.

◆ ends_with() [2/5]

bool xtd::ustring::ends_with ( const ustring value) const
noexcept

Determines whether the end of this string matches the specified string.

Parameters
valueThe string to compare to the substring at the end of this instance.
Returns
true if value matches the end of this instance; otherwise, false.

◆ ends_with() [3/5]

bool xtd::ustring::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 the specified culture.

Parameters
ignore_casetrue to ignore case during the comparison; otherwise, false.
Returns
bool true if value matches the end of the specified string; otherwise, false.

◆ ends_with() [4/5]

bool xtd::ustring::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 specified comparison option.

Parameters
comparison_typeOne of the enumeration values that determines how this string and value are compared.
Returns
bool true if value matches the end of the specified string; otherwise, false.

◆ ends_with() [5/5]

bool xtd::ustring::ends_with ( value_type  value) const
noexcept

Determines whether the end of this string matches the specified character.

Parameters
valueThe char_t to compare to the substring at the end of this instance.
Returns
true if value matches the end of this instance; otherwise, false.

◆ full_class_name() [1/3]

template<typename object_t >
static ustring xtd::ustring::full_class_name ( )
inlinestatic

Gets the fully qualified class name of the objec_t, including the namespace of the objec_t.

Returns
The fully qualified class name of the objec_t, including the namespace of the objec_t.
Remarks
For example, the fully qualified name of the ustring type is xtd::ustring.
Deprecated:
Replaced by typeof_<object_t>().full_name() - Will be removed in version 0.4.0

◆ full_class_name() [2/3]

template<typename object_t >
static ustring xtd::ustring::full_class_name ( const object_t &  object)
inlinestatic

Gets the fully qualified class name of the specified object, including the namespace of the specified object.

Returns
The fully qualified class name of the objec_t, including the namespace of the specified object.
Remarks
For example, the fully qualified name of the ustring type is xtd::ustring.
Deprecated:
Replaced by typeof_(object).full_name() - Will be removed in version 0.4.0

◆ full_class_name() [3/3]

static ustring xtd::ustring::full_class_name ( const std::type_info &  info)
static

Gets the fully qualified class name of the specified object, including the namespace of the specified object.

Returns
The fully qualified class name of the objec_t, including the namespace of the specified object.
Remarks
For example, the fully qualified name of the ustring type is xtd::ustring.
Deprecated:
Replaced by typeof_(info).full_name() - Will be removed in version 0.4.0

◆ get_hash_code()

size_t xtd::ustring::get_hash_code ( ) const
overridevirtualnoexcept

Returns the hash code for this string.

Returns
A hash code.

Reimplemented from xtd::object.

◆ index_of() [1/6]

size_t xtd::ustring::index_of ( const ustring value) const
noexcept

Reports the index of the first occurrence of the specified string in this string.

Parameters
valueAn unicode character to seek
Returns
The index position of value if that character is found, or std::basic_string<char_t>::npos if it is not.

◆ index_of() [2/6]

size_t xtd::ustring::index_of ( const ustring value,
size_t  start_index 
) const
noexcept

Reports the index of the first occurrence of the specified character in this string. The search starts at a specified character position.

Parameters
valueAn unicode character to seek
start_indexThe search starting position
Returns
The index position of value if that character is found, or std::basic_string<char_t>::npos if it is not.

◆ index_of() [3/6]

size_t xtd::ustring::index_of ( const ustring value,
size_t  start_index,
size_t  count 
) const
noexcept

Reports the index of the first occurrence of the specified character in this string. The search starts at a specified character position and examines a specified number of character positions.

Parameters
valueAn unicode character to seek
start_indexThe search starting position
countThe number of character positions to examine
Returns
The index position of value if that character is found, or std::basic_string<char_t>::npos if it is not.

◆ index_of() [4/6]

size_t xtd::ustring::index_of ( value_type  value) const
noexcept

Reports the index of the first occurrence of the specified character in this string.

Parameters
valueAn unicode character to seek
Returns
The index position of value if that character is found, or std::basic_string<char_t>::npos if it is not.
Examples
time_span_from_hours.cpp.

◆ index_of() [5/6]

size_t xtd::ustring::index_of ( value_type  value,
size_t  start_index 
) const
noexcept

Reports the index of the first occurrence of the specified character in this string. The search starts at a specified character position.

Parameters
valueAn unicode character to seek
start_indexThe search starting position
Returns
The index position of value if that character is found, or std::basic_string<char_t>::npos if it is not.

◆ index_of() [6/6]

size_t xtd::ustring::index_of ( value_type  value,
size_t  start_index,
size_t  count 
) const
noexcept

Reports the index of the first occurrence of the specified character in this string. The search starts at a specified character position and examines a specified number of character positions.

Parameters
valueAn unicode character to seek
start_indexThe search starting position
countThe number of character positions to examine
Returns
The index position of value if that character is found, or std::basic_string<char_t>::npos if it is not.

◆ index_of_any() [1/3]

size_t xtd::ustring::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 characters.

Parameters
valuesAn unicode character array containing one or more characters to seek
Returns
The index position of the first occurrence in this instance where any character in values was found; otherwise, std::basic_string<char_t>::npos if no character in values was found.

◆ index_of_any() [2/3]

size_t xtd::ustring::index_of_any ( const std::vector< value_type > &  values,
size_t  start_index 
) const
noexcept

Reports the index of the first occurrence in this instance of any character in a specified array of characters. The search starts at a specified character position.

Parameters
valuesAn unicode character array containing one or more characters to seek
start_indexThe search starting position
Returns
The index position of the first occurrence in this instance where any character in values was found; otherwise, std::basic_string<char_t>::npos if no character in values was found.

◆ index_of_any() [3/3]

size_t xtd::ustring::index_of_any ( const std::vector< value_type > &  values,
size_t  start_index,
size_t  count 
) const
noexcept

Reports the index of the first occurrence in this instance of any character in a specified array of characters. The search starts at a specified character position.

Parameters
valuesAn unicode character array containing one or more characters to seek
start_indexThe search starting position
countThe number of character positions to examine.
Returns
The index position of the first occurrence in this instance where any character in values was found; otherwise, std::basic_string<char_t>::npos if no character in values was found.

◆ insert()

ustring xtd::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.

Parameters
start_indexThe index position of the insertion.
valueThe string to insert.
Returns
A new string equivalent to this instance but with value inserted at position start_index.
Remarks
If start_index is equal to the length of this instance, value is appended to the end of this instance.
For example, the return value of "abc".Insert(2, "XYZ") is "abXYZc".

◆ is_empty() [1/2]

bool xtd::ustring::is_empty ( ) const
inlinenoexcept

Indicates whether this string is an empty string ("").

Returns
true if the value parameter is null or an empty string (""); otherwise, false.
Deprecated:
Replaced by xtd::ustring::is_empty(const xtd::ustring&) - Will be removed in version 0.4.0

◆ is_empty() [2/2]

static bool xtd::ustring::is_empty ( const xtd::ustring string)
staticnoexcept

Indicates whether the specifeid string is an empty string ("").

Parameters
stringThe xtd::ustring to check if empty.
Returns
true if the value parameter is null or an empty string (""); otherwise, false.

◆ join() [1/3]

template<typename collection_t >
static ustring xtd::ustring::join ( const ustring separator,
const collection_t &  values,
size_t  index 
)
inlinestaticnoexcept

Concatenates a specified separator string between each element of a specified object array, yielding a single concatenated string.

Parameters
separatorA string separator.
valuesAn array of Object.
start_indexThe first array element in value to use.
Returns
A string consisting of the elements of value interspersed with the separator string.
Remarks
For example if separator is ", " and the elements of value are "red", "blue", "green", and "yellow", Join(separator, value) returns "red, blue, green, yellow".
stream << operator is called on each object to generate the content.

◆ join() [2/3]

template<typename collection_t >
static ustring xtd::ustring::join ( const ustring separator,
const collection_t &  values,
size_t  index,
size_t  count 
)
inlinestaticnoexcept

Concatenates a specified separator string between each element of a specified Object array, yielding a single concatenated string.

Parameters
separatorA string separator.
valuesAn array of Object.
start_indexThe first array element in value to use.
countThe number of elements of value to use.
Returns
A string consisting of the elements of value interspersed with the separator string.
Remarks
For example if separator is ", " and the elements of value are "red", "blue", "green", and "yellow", Join(separator, value) returns "red, blue, green, yellow".
stream << operator is called on each object to generate the content.

◆ join() [3/3]

template<typename collection_t >
static ustring xtd::ustring::join ( const ustring  separator,
const collection_t &  values 
)
inlinestaticnoexcept

Concatenates a specified separator string between each element of a specified object array, yielding a single concatenated string.

Parameters
separatorA string separator.
valuesAn array of Object.
Returns
A string consisting of the elements of value interspersed with the separator string.
Remarks
For example if separator is ", " and the elements of value are "red", "blue", "green", and "yellow", Join(separator, value) returns "red, blue, green, yellow".
stream << operator is called on each object to generate the content.
Examples
test_forms.cpp, and uri.cpp.

◆ last_index_of() [1/6]

size_t xtd::ustring::last_index_of ( const ustring value) const
noexcept

Reports the index of the last occurrence of the specified string in this string.

Parameters
valueAn unicode character to seek
Returns
The index position of value if that character is found, or std::basic_string<char_t>::npos if it is not.

◆ last_index_of() [2/6]

size_t xtd::ustring::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. The search starts at a specified character position.

Parameters
valueAn unicode character to seek
start_indexThe search starting position
Returns
The index position of value if that character is found, or std::basic_string<char_t>::npos if it is not.

◆ last_index_of() [3/6]

size_t xtd::ustring::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. The search starts at a specified character position and examines a specified number of character positions.

Parameters
valueAn unicode character to seek
start_indexThe search starting position
countThe number of character positions to examine
Returns
The index position of value if that character is found, or std::basic_string<char_t>::npos if it is not.

◆ last_index_of() [4/6]

size_t xtd::ustring::last_index_of ( value_type  value) const
noexcept

Reports the index of the last occurrence of the specified character in this tring.

Parameters
valueAn unicode character to seek
Returns
The index position of value if that character is found, or std::basic_string<char_t>::npos if it is not.
Examples
test_forms.cpp.

◆ last_index_of() [5/6]

size_t xtd::ustring::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. The search starts at a specified character position.

Parameters
valueAn unicode character to seek
start_indexThe search starting position
Returns
The index position of value if that character is found, or std::basic_string<char_t>::npos if it is not.

◆ last_index_of() [6/6]

size_t xtd::ustring::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. The search starts at a specified character position and examines a specified number of character positions.

Parameters
strA string to find last index of.
valueAn unicode character to seek
start_indexThe search starting position
countThe number of character positions to examine
Returns
The index position of value if that character is found, or std::basic_string<char_t>::npos if it is not.

◆ last_index_of_any() [1/3]

size_t xtd::ustring::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 characters.

Parameters
valuesAn unicode character array containing one or more characters to seek
Returns
The index position of the first occurrence in this instance where any character in values was found; otherwise, std::basic_string<char_t>::npos if no character in values was found.

◆ last_index_of_any() [2/3]

size_t xtd::ustring::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 characters. The search starts at a specified character position.

Parameters
valuesAn unicode character array containing one or more characters to seek
start_indexThe search starting position
Returns
The index position of the first occurrence in this instance where any character in values was found; otherwise, std::basic_string<char_t>::npos if no character in values was found.

◆ last_index_of_any() [3/3]

size_t xtd::ustring::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 characters. The search starts at a specified character position.

Parameters
valuesAn unicode character array containing one or more characters to seek
start_indexThe search starting position
countThe number of character positions to examine.
Returns
The index position of the first occurrence in this instance where any character in values was found; otherwise, std::basic_string<char_t>::npos if no character in values was found.

◆ pad_left() [1/2]

ustring xtd::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 length.

Parameters
total_widthThe number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.
Returns
A new string that is equivalent to the specified string, but right-aligned and padded on the left with as many spaces as needed to create a length of total_width. Or, if total_width is less than the length of the specified string, a new string object that is identical to the specified string.
Remarks
An unicode space is defined as hexadecimal 0x20.
The pad_left(const std::basic_string<char_t>&, int) method pads the beginning of the returned string. This means that, when used with right-to-left languages, it pads the right portion of the string..

◆ pad_left() [2/2]

ustring xtd::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 length.

Parameters
total_widthThe number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.
paddingCharAn unicode padding character.
Returns
A new string that is equivalent to the specified string, but right-aligned and padded on the left with as many spaces as needed to create a length of total_width. Or, if total_width is less than the length of the specified string, a new string object that is identical the specified string.
Remarks
An unicode space is defined as hexadecimal 0x20.
The pad_left(const std::basic_string<char_t>&, int) method pads the beginning of the returned string. This means that, when used with right-to-left languages, it pads the right portion of the string..

◆ pad_right() [1/2]

ustring xtd::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 length.

Parameters
totalWidthThe number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.
Returns
A new string that is equivalent to the specified string, but left-aligned and padded on the right with as many spaces as needed to create a length of totalWidth. Or, if totalWidth is less than the length of the specified string, a new string object that is identical to the specified string.
Remarks
An unicode space is defined as hexadecimal 0x20.
The PadRight(const std::basic_string<char_t>&, int) method pads the end of the returned string. This means that, when used with right-to-left languages, it pads the left portion of the string..

◆ pad_right() [2/2]

ustring xtd::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 length.

Parameters
totalWidthThe number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.
paddingCharAn unicode padding character.
Returns
A new string that is equivalent to the specified string, but left-aligned and padded on the tight with as many spaces as needed to create a length of totalWidth. Or, if totalWidth is less than the length of the specified string, a new string object that is identical to the specified string.
Remarks
An unicode space is defined as hexadecimal 0x20.
The xtd::ustring::pad_right method pads the end of the returned string. This means that, when used with right-to-left languages, it pads the left portion of the string..

◆ parse()

template<typename value_t >
static value_t xtd::ustring::parse ( const ustring str)
inlinestatic

Converts a string into a value_t type.

Parameters
strAx xtd::ustring to convert to value_t
Returns
The value_t object parsed.

◆ quoted() [1/2]

ustring xtd::ustring::quoted ( ) const

Allows insertion and extraction of quoted strings, such as the ones found in CSV or XML.

Returns
A new quoted string.
Remarks
the delimiter is set to
" 
by default and the escape is set to \ by default.
for more information see std::quoted.

◆ quoted() [2/2]

ustring xtd::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 delimiter and escape.

Parameters
delimiterThe character to use as the delimiter, defaults to "</tt>. @param escape The character to use as the escape character, defaults to <tt>\\</tt>. @return A new quoted string. @remarks for more information see <a href="https://en.cppreference.com/w/cpp/io/manip/quoted" >std::quoted.

◆ remove() [1/2]

ustring xtd::ustring::remove ( size_t  start_index) const
noexcept

Deletes all the characters from this string beginning at a specified position and continuing through the last position.

Parameters
start_indexThe position to begin deleting characters.
Returns
A new string object that is equivalent to this string less the removed characters.

◆ remove() [2/2]

ustring xtd::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 the last position.

Parameters
start_indexThe position to begin deleting characters.
countThe number of characters to delete.
Returns
A new string object that is equivalent to this string less the removed characters.

◆ replace() [1/2]

ustring xtd::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.

Parameters
old_stringA string to be replaced.
new_stringA string to replace all occurrences of old_string.
Returns
A new string equivalent to the specified string but with all instances of old_string replaced with new_string.
Remarks
If new_string is empty, all occurrences of old_string are removed

◆ replace() [2/2]

ustring xtd::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.

Parameters
old_charA char_t to be replaced.
new_charA char_t to replace all occurrences of old_char.
Returns
A new string equivalent to the specified string but with all instances of old_char replaced with new_char.
Examples
file_info_replace.cpp.

◆ split() [1/5]

std::vector< ustring > xtd::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 xtd::char_object::isspace() or std::iswspace() method.

Returns
An array whose elements contain the substrings in this string that are delimited by one or more characters in white-space separators. For more information, see the Remarks section.
Remarks
Delimiter characters are not included in the elements of the returned array.
If the specified string does not contain any of the characters in separator, or the count parameter is 1, the returned array consists of a single element that contains the specified string.

◆ split() [2/5]

std::vector< ustring > xtd::ustring::split ( const std::vector< value_type > &  separators) const
noexcept

Splits this string into substrings that are based on the characters in an array.

Parameters
separatorsA character array that delimits the substrings in this string, an empty array that contains no delimiters.
Returns
An array whose elements contain the substrings in this string that are delimited by one or more characters in separators. For more information, see the Remarks section.
Remarks
Delimiter characters are not included in the elements of the returned array.
If the specified string does not contain any of the characters in separator, or the count parameter is 1, the returned array consists of a single element that contains the specified string.

◆ split() [3/5]

std::vector< ustring > xtd::ustring::split ( const std::vector< value_type > &  separators,
size_t  count 
) const
noexcept

Splits this string into a maximum number of substrings based on the characters in an array. You also specify the maximum number of substrings to return.

Parameters
separatorsA character array that delimits the substrings in this string, an empty array that contains no delimiters.
countThe maximum number of substrings to return.
Remarks
Delimiter characters are not included in the elements of the returned array.
If the specified string does not contain any of the characters in separator, or the count parameter is 1, the returned array consists of a single element that contains the specified string.
If the separator parameter contains no characters, white-space characters are assumed to be the delimiters. White-space characters are defined by the Unicode standard and return true if they are passed to the char_t.IsWhiteSpace method.
Each element of separator defines a separate delimiter character. If two delimiters are adjacent, or a delimiter is found at the beginning or end of the specified string, the corresponding array element contains empty string.
If there are more than count substrings in the specified string, the first count minus 1 substrings are returned in the first count minus 1 elements of the return value, and the remaining characters in the specified string are returned in the last element of the return value.

◆ split() [4/5]

std::vector< ustring > xtd::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.

Parameters
separatorsA character array that delimits the substrings in this string, an empty array that contains no delimiters.
countThe maximum number of substrings to return.
optionsxtd::string_split_options::remove_empty_entries to omit empty array elements from the array returned; or None to include empty array elements in the array returned.
Returns
An array whose elements contain the substrings in this string that are delimited by one or more characters in separators. For more information, see the Remarks section.
Remarks
Delimiter characters are not included in the elements of the returned array.
If the specified string does not contain any of the characters in separator, or the count parameter is 1, the returned array consists of a single element that contains the specified string.
If the count parameter is zero, or the options parameter is remove_empty_entries and the length of the specified string is zero, an empty array is returned.
Each element of separator defines a separate delimiter character. If the options parameter is None, and two delimiters are adjacent or a delimiter is found at the beginning or end of the specified string, the corresponding array element contains an empty string.
If there are more than count substrings in the specified string, the first count minus 1 substrings are returned in the first count minus 1 elements of the return value, and the remaining characters in the specified string are returned in the last element of the return value.
If count is greater than the number of substrings, the available substrings are returned.
Examples
split.cpp.

◆ split() [5/5]

std::vector< ustring > xtd::ustring::split ( const std::vector< value_type > &  separators,
string_split_options  options 
) const
noexcept

Splits this string into substrings based on the characters in an array. You can specify whether the substrings include empty array elements.

Parameters
separatorsA character array that delimits the substrings in this string, an empty array that contains no delimiters.
optionsxtd::string_split_options::remove_empty_entries to omit empty array elements from the array returned; or None to include empty array elements in the array returned.
Returns
An array whose elements contain the substrings in this string that are delimited by one or more characters in separators. For more information, see the Remarks section.
Remarks
Delimiter characters are not included in the elements of the returned array.
If the specified string does not contain any of the characters in separator, or the count parameter is 1, the returned array consists of a single element that contains the specified string.
If the specified string does not contain any of the characters in separator, the returned array consists of a single element that contains the specified string.
If the options parameter is remove_empty_entries and the length of the specified string is zero, the method returns an empty array.
Each element of separator defines a separate delimiter that consists of a single character. If the options argument is none, and two delimiters are adjacent or a delimiter is found at the beginning or end of the specified string, the corresponding array element contains empty string. For example, if separator includes two elements, "-" and "_", the value of the string instance is "-_aa-_", and the value of the options argument is None, the method returns a string array with the following five elements:
  1. empty string, which represents the empty string that precedes the "-" character at index 0.
  2. empty string, which represents the empty string between the "-" character at index 0 and the "_" character at index 1.
  3. "aa",
  4. empty string, which represents the empty string that follows the "_" character at index 4.
  5. empty string, which represents the empty string that follows the "-" character at index 5.
If the separator parameter contains no characters, white-space characters are assumed to be the delimiters. White-space characters are defined by the c++ standard and return true if they are passed to the xtd::char_object::isspace() or std::iswspace() method.
If count is greater than the number of substrings, the available substrings are returned.

◆ starts_with() [1/4]

bool xtd::ustring::starts_with ( const ustring value) const
noexcept

Determines whether the beginning of this instance of xtd::ustring matches a specified xtd::ustring.

Parameters
valueA xtd::ustring to compare to.
Returns
bool true if value matches the beginning of the specified string; otherwise, false.
Remarks
This method compares value to the substring at the beginning of the specified string that is the same length as value, and returns an indication whether they are equal. To be equal, value must be a reference to this same instance, or match the beginning of the specified string.

◆ starts_with() [2/4]

bool xtd::ustring::starts_with ( const ustring value,
bool  ignore_case 
) const
noexcept

Determines whether the beginning of this instance of xtd::ustring matches a specified xtd::ustring, ignoring or honoring their case.

Parameters
valueA xtd::ustring to compare to.
ignore_casetrue to ignore case when comparing the specified string and value; otherwise, false
Returns
bool true if value matches the beginning of the specified string; otherwise, false.
Remarks
This method compares value to the substring at the beginning of the specified string that is the same length as value, and returns an indication whether they are equal. To be equal, value must be a reference to this same instance, or match the beginning of the specified string.

◆ starts_with() [3/4]

bool xtd::ustring::starts_with ( value_type  value) const
noexcept

Determines whether the beginning of this instance of xtd::ustring matches a specified xtd::ustring.

Parameters
valueA xtd::ustring to compare to.
Returns
bool true if value matches the beginning of the specified string; otherwise, false.
Remarks
This method compares value to the substring at the beginning of the specified string that is the same length as value, and returns an indication whether they are equal. To be equal, value must be a reference to this same instance, or match the beginning of the specified string.

◆ starts_with() [4/4]

bool xtd::ustring::starts_with ( value_type  value,
bool  ignore_case 
) const
noexcept

Determines whether the beginning of this instance of xtd::ustring matches a specified xtd::ustring, ignoring or honoring their case.

Parameters
valueA xtd::ustring to compare to.
ignore_casetrue to ignore case when comparing the specified string and value; otherwise, false
Returns
bool true if value matches the beginning of the specified string; otherwise, false.
Remarks
This method compares value to the substring at the beginning of the specified string that is the same length as value, and returns an indication whether they are equal. To be equal, value must be a reference to this same instance, or match the beginning of the specified string.

◆ substring() [1/2]

ustring xtd::ustring::substring ( size_t  start_index) const
noexcept

Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length.

Parameters
strstring to substring.
start_indexThe zero-based starting character position of a substring in this instance.
Returns
A string equivalent to the substring of length length that begins at start_index in this instance, or Empty if start_index is equal to the length of this instance and length is zero.
Examples
test_forms.cpp.

◆ substring() [2/2]

ustring xtd::ustring::substring ( size_t  start_index,
size_t  length 
) const
noexcept

Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length.

Parameters
start_indexThe zero-based starting character position of a substring in this instance.
lengthThe number of characters in the substring.
Returns
A string equivalent to the substring of length length that begins at start_index in this instance, or Empty if start_index is equal to the length of this instance and length is zero.

◆ to_array() [1/3]

std::vector< value_type > xtd::ustring::to_array ( ) const
noexcept

Copies the characters in this instance to a Unicode character array.

Returns
A character array whose elements are the individual characters of this instance. If this instance is an empty xtd::ustring, the returned array is empty and has a zero length.

◆ to_array() [2/3]

std::vector< value_type > xtd::ustring::to_array ( size_t  start_index) const
noexcept

Copies the characters in this instance to a Unicode character array starting at specified index.

Parameters
start_indexThe starting position of string to convert.
Returns
A character array whose elements are the individual characters of this instance. If this instance is an empty xtd::ustring, the returned array is empty and has a zero length.

◆ to_array() [3/3]

std::vector< value_type > xtd::ustring::to_array ( size_t  start_index,
size_t  length 
) const
noexcept

Copies the characters in this instance to a Unicode character array starting at specified index with specified length.

Parameters
start_indexThe starting position of string to convert.
lengthThe length of the string to convert
Returns
A character array whose elements are the individual characters of this instance. If this instance is an empty xtd::ustring, the returned array is empty and has a zero length.

◆ to_lower()

ustring xtd::ustring::to_lower ( ) const
noexcept

Returns a copy of the current string converted to lowercase.

Returns
A new string in lowercase.

◆ to_string()

ustring xtd::ustring::to_string ( ) const
overridevirtualnoexcept

Returns a sxd::ustring that represents the current object.

Returns
A string that represents the current object.
Examples
The following code example demonstrates what to_string returns.

Reimplemented from xtd::object.

◆ to_title_case()

ustring xtd::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).

Returns
A new string in title case.

◆ to_upper()

ustring xtd::ustring::to_upper ( ) const
noexcept

Returns a copy of the current string converted to uppercase.

Returns
A new string in uppercase.

◆ trim() [1/3]

ustring xtd::ustring::trim ( ) const
noexcept

Removes all leading and trailing occurrences of white-space characters from the specified xtd::ustring.

Parameters
strxtd::ustring to trim end.
trim_charA character to remove.
Returns
The xtd::ustring that remains after all occurrences of the character in the trim_char parameter are removed from the start and te and of the specified xtd::ustring.

◆ trim() [2/3]

ustring xtd::ustring::trim ( const std::vector< value_type > &  trim_chars) const
noexcept

Removes all leading and trailing occurrences of a set of characters specified in an array from the specified xtd::ustring.

Parameters
strxtd::ustring to trim end.
trim_charsAn array of characters to remove.
Returns
The xtd::ustring that remains after all occurrences of the characters in the trim_chars parameter are removed from the start and the edn of the specified xtd::ustring.

◆ trim() [3/3]

ustring xtd::ustring::trim ( value_type  trim_char) const
noexcept

Removes all leading and trailing occurrences of a character specified from the specified xtd::ustring .

Parameters
strxtd::ustring to trim start.
trim_charA character to remove.
Returns
The xtd::ustring that remains after all occurrences of the character in the trim_char parameter are removed from the start and the end of the specified xtd::ustring.

◆ trim_end() [1/3]

ustring xtd::ustring::trim_end ( ) const
noexcept

Removes all trailing occurrences of white-space characters from the specified xtd::ustring.

Parameters
strxtd::ustring to trim end.
trim_charA character to remove.
Returns
The xtd::ustring that remains after all occurrences of the character in the trim_char parameter are removed from the end of the specified xtd::ustring.

◆ trim_end() [2/3]

ustring xtd::ustring::trim_end ( const std::vector< value_type > &  trim_chars) const
noexcept

Removes all trailing occurrences of a set of characters specified in an array from the specified xtd::ustring.

Parameters
strxtd::ustring to trim end.
trim_charsAn array of characters to remove.
Returns
The xtd::ustring that remains after all occurrences of the characters in the trim_chars parameter are removed from the end of the specified xtd::ustring.

◆ trim_end() [3/3]

ustring xtd::ustring::trim_end ( value_type  trim_char) const
noexcept

Removes all trailing occurrences of a character specified from the specified xtd::ustring .

Parameters
strxtd::ustring to trim start.
trim_charA character to remove.
Returns
The xtd::ustring that remains after all occurrences of the character in the trim_char parameter are removed from the end of the specified xtd::ustring.

◆ trim_start() [1/3]

ustring xtd::ustring::trim_start ( ) const
noexcept

Removes all leading occurrences of white-space characters from the specified xtd::ustring.

Parameters
strxtd::ustring to trim start.
trim_charA character to remove.
Returns
The xtd::ustring that remains after all occurrences of the character in the trim_char parameter are removed from the start of the specified xtd::ustring.

◆ trim_start() [2/3]

ustring xtd::ustring::trim_start ( const std::vector< value_type > &  trim_chars) const
noexcept

Removes all leading occurrences of a set of characters specified in an array from the specified xtd::ustring.

Parameters
strAn xtd::ustring to trim start.
trim_charsAn array of characters to remove.
Returns
The xtd::ustring that remains after all occurrences of the characters in the trim_chars parameter are removed from the start of the specified xtd::ustring.

◆ trim_start() [3/3]

ustring xtd::ustring::trim_start ( value_type  trim_char) const
noexcept

Removes all leading occurrences of a character specified from the specified xtd::ustring .

Parameters
strxtd::ustring to trim start.
trim_charA character to remove.
Returns
The xtd::ustring that remains after all occurrences of the character in the trim_char parameter are removed from the start of the specified xtd::ustring.

◆ try_parse()

template<typename value_t >
static bool xtd::ustring::try_parse ( const ustring str,
value_t &  value 
)
inlinestaticnoexcept

Try to convert a string into a value_t type.

Parameters
strAn xtd::ustring to convert to value_t
valueThe value that will contain the parsed xtd::ustring.
Returns
true if xtd::ustring:=:try_parse succed; otherwise, false.

Member Data Documentation

◆ empty_string

const ustring xtd::ustring::empty_string
static

Represents the empty string.

Remarks
The value of this method is the zero-length string, "".

The documentation for this class was generated from the following file: