xtd 0.2.0
Loading...
Searching...
No Matches
xtd::basic_string< char_t, traits_t, allocator_t > Class Template Reference
Inheritance diagram for xtd::basic_string< char_t, traits_t, allocator_t >:
xtd::object xtd::icomparable< basic_string< char_t, traits_t, allocator_t > > xtd::iequatable< basic_string< char_t, traits_t, allocator_t > > xtd::collections::generic::ienumerable< char_t > xtd::collections::generic::extensions::enumerable< ienumerable< char_t >, char_t > xtd::collections::generic::extensions::enumerable_iterators< char_t, xtd::collections::generic::ienumerable< char_t > > xtd::collections::generic::ienumerable_abstract xtd::interface xtd::extensions::equality_operators< basic_string< char_t, traits_t, allocator_t >, iequatable< basic_string< char_t, traits_t, allocator_t > > > xtd::interface xtd::extensions::comparison_operators< basic_string< char_t, traits_t, allocator_t >, icomparable< basic_string< char_t, traits_t, allocator_t > > > xtd::interface

Definition

template<class char_t, class traits_t, class allocator_t>
class xtd::basic_string< char_t, traits_t, allocator_t >

Represents text as a sequence of character units.

Namespace
xtd
Library
xtd.core
Remarks
A basic_string is a sequential collection of characters that's used to represent text. A xtd::basic_string object is a sequential collection of char that represent a basic_string. The value of the xtd::basic_string object is the content of the sequential collection of char_t, and unlike std::basic_string<char_t> that value is immutable (that is, it is read-only).
If you want the same mutable basic_string class, you can use xtd::text::basic_string_builder <char_t> class.
xtd::basic_string implements std::basic_string<char> and therefore offers the full (immutable) API of std::basic_string.
Several aliases for common character types are provided:
Type Definition
xtd::string xtd::basic_string <char>
xtd::u16string xtd::basic_string <xtd::char16>
xtd::u32string xtd::basic_string <xtd::char32>
xtd::u8string xtd::basic_string <xtd::char8>
xtd::wstring xtd::basic_string <xtd::wchar>
Namespace
xtd
Library
xtd.core
Remarks
A basic_string is a sequential collection of characters that's used to represent text. A xtd::basic_string object is a sequential collection of char that represent a basic_string. The value of the xtd::basic_string object is the content of the sequential collection of char_t, and unlike std::basic_string<char_t> that value is immutable (that is, it is read-only).
If you want the same mutable basic_string class, you can use xtd::text::basic_string_builder <char_t> class.
xtd::basic_string implements std::basic_string<char> and therefore offers the full (immutable) API of std::string.

Static Public Member Functions

template<class object_t>
static basic_string class_name ()
 Gets the class name of the object_t.
 
template<class object_t>
static basic_string class_name (const object_t &object)
 Gets the class name of the specified object.
 
static basic_string class_name (const std::type_info &info)
 Gets the class name of the specified object.
 
template<class object_t>
static basic_string full_class_name ()
 Gets the fully qualified class name of the objec_t, including the namespace of the objec_t.
 
template<class object_t>
static basic_string full_class_name (const object_t &object)
 Gets the fully qualified class name of the specified object, including the namespace of the specified object.
 
static basic_string full_class_name (const std::type_info &info)
 Gets the fully qualified class name of the specified object, including the namespace of the specified object.
 
template<class object_a_t, class object_b_t>
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<class object_a_t, class object_b_t>
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 
static auto to_const_iterator (typename source_collection_t::const_iterator &value, const source_collection_t &source_collection, const target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator
 Converts source iterator to target iterator.
 
static auto to_const_iterator (typename source_collection_t::const_iterator &value, source_collection_t &source_collection, target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator
 Converts source iterator to target iterator.
 
static auto to_iterator (typename source_collection_t::const_iterator &value, const source_collection_t &source_collection, const target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator
 Converts source iterator to target iterator.
 
static auto to_iterator (typename source_collection_t::iterator &value, const source_collection_t &source_collection, const target_collection_t &target_collection) noexcept -> typename target_collection_t::iterator
 Converts source iterator to target iterator.
 
static auto to_iterator (typename source_collection_t::const_iterator &value, source_collection_t &source_collection, target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator
 Converts source iterator to target iterator.
 
static auto to_iterator (typename source_collection_t::iterator &value, source_collection_t &source_collection, target_collection_t &target_collection) noexcept -> typename target_collection_t::iterator
 Converts source iterator to target iterator.
 

Public Aliases

using base_type
 Represents the basic string base type.
 
using traits_type
 Represents the basic string traits type.
 
using value_type
 Represents the basic string value type.
 
using allocator_type
 Represents the basic string allocator type.
 
using size_type
 Represents the basic string size type.
 
using difference_type
 Represents the basic string difference type.
 
using reference
 Represents the basic string referecne type.
 
using const_reference
 Represents the basic string const referecne type.
 
using pointer
 Represents the basic string pointer type.
 
using const_pointer
 Represents the basic string const pointer type.
 
using iterator
 Represents the basic string iterator type.
 
using const_iterator
 Represents the basic string const iterator type.
 
using reverse_iterator
 Represents the basic string reverse iterator type.
 
using const_reverse_iterator
 Represents the basic string const reverse iterator type.
 
using enumerator_type
 Represents the basic string enumerator type.
 

Public Fields

static const basic_string empty_string
 Represents the empty basic_string.
 
static constexpr size_type npos
 Represents a value that is not a valid position in a collection.
 
static constexpr xtd::size bpos
 Represents the index of the first valid element in a collection.
 
static constexpr xtd::size epos
 Represents the index of the last valid element in a collection.
 

Public Constructors

 basic_string ()=default
 Initializes a new instance of xtd::basic_string.
 
 basic_string (basic_string &&)=default
 Initializes a new instance of xtd::basic_string with specified string to move.
 
 basic_string (std::basic_string< char_t > &&str)
 Initializes a new instance of xtd::basic_string with specified string to move.
 
 basic_string (const basic_string< char > &str) noexcept
 Initializes a new instance of xtd::basic_string with specified string to copy.
 
 basic_string (const basic_string< xtd::char16 > &str) noexcept
 Initializes a new instance of xtd::basic_string with specified string to copy.
 
 basic_string (const basic_string< xtd::char32 > &str) noexcept
 Initializes a new instance of xtd::basic_string with specified string to copy.
 
 basic_string (const basic_string< xtd::char8 > &str) noexcept
 Initializes a new instance of xtd::basic_string with specified string to copy.
 
 basic_string (const basic_string< xtd::wchar > &str) noexcept
 Initializes a new instance of xtd::basic_string with specified string to copy.
 
 basic_string (const std::basic_string< char > &str) noexcept
 Initializes a new instance of xtd::basic_string with specified string to copy.
 
 basic_string (const std::basic_string< xtd::char16 > &str) noexcept
 Initializes a new instance of xtd::basic_string with specified string to copy.
 
 basic_string (const std::basic_string< xtd::char32 > &str) noexcept
 Initializes a new instance of xtd::basic_string with specified string to copy.
 
 basic_string (const std::basic_string< xtd::char8 > &str) noexcept
 Initializes a new instance of xtd::basic_string with specified string to copy.
 
 basic_string (const std::basic_string< xtd::wchar > &str) noexcept
 Initializes a new instance of xtd::basic_string with specified string to copy.
 
 basic_string (char character, xtd::size count)
 Initializes a new instance of xtd::basic_string with specified count copies of character.
 
 basic_string (xtd::char16 character, xtd::size count)
 Initializes a new instance of xtd::basic_string with specified count copies of character.
 
 basic_string (xtd::char32 character, xtd::size count)
 Initializes a new instance of xtd::basic_string with specified count copies of character.
 
 basic_string (xtd::char8 character, xtd::size count)
 Initializes a new instance of xtd::basic_string with specified count copies of character.
 
 basic_string (xtd::wchar character, xtd::size count)
 Initializes a new instance of xtd::basic_string with specified count copies of character.
 
 basic_string (const char *str)
 Initializes a new instance of xtd::basic_string with specified string to copy.
 
 basic_string (const xtd::char16 *str)
 Initializes a new instance of xtd::basic_string with specified string to copy.
 
 basic_string (const xtd::char32 *str)
 Initializes a new instance of xtd::basic_string with specified string to copy.
 
 basic_string (const xtd::char8 *str)
 Initializes a new instance of xtd::basic_string with specified string to copy.
 
 basic_string (const xtd::wchar *str)
 Initializes a new instance of xtd::basic_string with specified string to copy.
 
 basic_string (const char *str, xtd::size count)
 Initializes a new instance of xtd::basic_string with specified substring and count characters.
 
 basic_string (const xtd::char16 *str, xtd::size count)
 Initializes a new instance of xtd::basic_string with specified substring and count characters.
 
 basic_string (const xtd::char32 *str, xtd::size count)
 Initializes a new instance of xtd::basic_string with specified substring and count characters.
 
 basic_string (const xtd::char8 *str, xtd::size count)
 Initializes a new instance of xtd::basic_string with specified substring and count characters.
 
 basic_string (const xtd::wchar *str, xtd::size count)
 Initializes a new instance of xtd::basic_string with specified substring and count characters.
 
template<class input_iterator_t>
 basic_string (input_iterator_t first, input_iterator_t last)
 Initializes a new instance of xtd::basic_string with specified first and last iterators of substring.
 
 basic_string (const std::basic_string_view< char_t > &str)
 Initializes a new instance of xtd::basic_string with specified std::basic_string_view.
 
 basic_string (std::initializer_list< char > il)
 Initializes a new instance of xtd::basic_string with specified initializer list.
 
 basic_string (std::initializer_list< xtd::char16 > il)
 Initializes a new instance of xtd::basic_string with specified initializer list.
 
 basic_string (std::initializer_list< xtd::char32 > il)
 Initializes a new instance of xtd::basic_string with specified initializer list.
 
 basic_string (std::initializer_list< xtd::char8 > il)
 Initializes a new instance of xtd::basic_string with specified initializer list.
 
 basic_string (std::initializer_list< xtd::wchar > il)
 Initializes a new instance of xtd::basic_string with specified initializer list.
 

Public Properties

const_pointer c_str () const noexcept
 Returns a pointer to a null-terminated character array with data equivalent to those stored in the string.
 
const base_typechars () const noexcept
 Returns a reference to the underlying base type.
 
base_typechars () noexcept
 Returns a reference to the underlying base type.
 
virtual size_type count () const noexcept
 Gets the number of characters in the current xtd::basic_string object.
 
const_pointer data () const noexcept
 Returns a pointer to the underlying array serving as character storage. The pointer is such that the range [data(), data() + size()] is valid and the values in it correspond to the values stored in the string.
 
virtual bool empty () const noexcept
 Checks whether the container is empty.
 
virtual size_type length () const noexcept
 Gets the number of characters in the current xtd::basic_string object.
 
virtual size_type size () const noexcept
 Gets the number of characters in the current xtd::basic_string object.
 

Public Methods

int32 compare (const basic_string &str) const
 Compares two character sequences.
 
int32 compare (size_type pos1, size_type count1, const basic_string &str) const
 Compares two character sequences.
 
int32 compare (size_type pos1, size_type count1, const basic_string &str, size_type pos2) const
 Compares two character sequences.
 
int32 compare (size_type pos1, size_type count1, const basic_string &str, size_type pos2, size_type count2) const
 Compares two character sequences.
 
int32 compare (const_pointer s) const
 Compares two character sequences.
 

Returns a reference to the character at specified location index. /

/

/ /

Parameters
indexThe position of the character to return. /
Returns
Reference to the requested character. /
Exceptions
xtd::index_out_of_range_exceptionIf `index` is not within the range of the string. const_reference operator [](xtd::size index) const { if (index >= length() && index != epos) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::index_out_of_range); return chars_[index == epos ? length() - 1 : index]; }

/ Returns a reference to the underlying base type. /

Returns
Reference to the underlying base type. operator const base_type& () const noexcept {return chars_;}

/ Copy assignment operator. Replaces the contents with a copy of the contents of str. /

Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(const basic_string<char>& str) noexcept { if constexpr(std::is_same<char_t, char>::value) chars_ = str.chars_; else chars_ = __xtd_convert_to_string<value_type>(str.chars()); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of str. /
Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(const basic_string<xtd::char16>& str) noexcept { if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str.chars_; else chars_ = __xtd_convert_to_string<value_type>(str.chars()); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of str. /
Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(const basic_string<xtd::char32>& str) noexcept { if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str.chars_; else chars_ = __xtd_convert_to_string<value_type>(str.chars()); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of str. /
Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(const basic_string<xtd::char8>& str) noexcept { if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str.chars_; else chars_ = __xtd_convert_to_string<value_type>(str.chars()); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of str. /
Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(const basic_string<xtd::wchar>& str) noexcept { if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str.chars_; else chars_ = __xtd_convert_to_string<value_type>(str.chars()); return self_; }

/ Move assignment operator. Replaces the contents with those of other using move semantics (i.e. the data in str is moved from str into this string). str is in a valid but unspecified state afterwards. /

Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(basic_string<char>&& str) noexcept { if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str.chars_); else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_))); return self_; } / Move assignment operator. Replaces the contents with those of other using move semantics (i.e. the data in str is moved from str into this string). str is in a valid but unspecified state afterwards. /
Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(basic_string<xtd::char16>&& str) noexcept { if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str.chars_); else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_))); return self_; } / Move assignment operator. Replaces the contents with those of other using move semantics (i.e. the data in str is moved from str into this string). str is in a valid but unspecified state afterwards. /
Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(basic_string<xtd::char32>&& str) noexcept { if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str.chars_); else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_))); return self_; } / Move assignment operator. Replaces the contents with those of other using move semantics (i.e. the data in str is moved from str into this string). str is in a valid but unspecified state afterwards. /
Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(basic_string<xtd::char8>&& str) noexcept { if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str.chars_); else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_))); return self_; } / Move assignment operator. Replaces the contents with those of other using move semantics (i.e. the data in str is moved from str into this string). str is in a valid but unspecified state afterwards. /
Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(basic_string<xtd::wchar>&& str) noexcept { if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str.chars_); else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str.chars_))); return self_; }

/ Copy assignment operator. Replaces the contents with a copy of the contents of str. /

Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(const std::basic_string<char>& str) noexcept { if constexpr(std::is_same<char_t, char>::value) chars_ = str; else chars_ = __xtd_convert_to_string<value_type>(str); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of str. /
Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(const std::basic_string<xtd::char16>& str) noexcept { if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = str; else chars_ = __xtd_convert_to_string<value_type>(str); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of str. /
Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(const std::basic_string<xtd::char32>& str) noexcept { if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = str; else chars_ = __xtd_convert_to_string<value_type>(str); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of str. /
Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(const std::basic_string<xtd::char8>& str) noexcept { if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = str; else chars_ = __xtd_convert_to_string<value_type>(str); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of str. /
Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(const std::basic_string<xtd::wchar>& str) noexcept { if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = str; else chars_ = __xtd_convert_to_string<value_type>(str); return self_; }

/ Copy assignment operator. Replaces the contents with a copy of the contents of str. /

Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(std::basic_string<char>&& str) noexcept { if constexpr(std::is_same<char_t, char>::value) chars_ = std::move(str); else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str))); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of str. /
Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(std::basic_string<xtd::char16>&& str) noexcept { if constexpr(std::is_same<char_t, xtd::char16>::value) chars_ = std::move(str); else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str))); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of str. /
Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(std::basic_string<xtd::char32>&& str) noexcept { if constexpr(std::is_same<char_t, xtd::char32>::value) chars_ = std::move(str); else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str))); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of str. /
Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(std::basic_string<xtd::char8>&& str) noexcept { if constexpr(std::is_same<char_t, xtd::char8>::value) chars_ = std::move(str); else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str))); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of str. /
Parameters
strString to use as data source. /
Returns
This current instance. basic_string& operator =(std::basic_string<xtd::wchar>&& str) noexcept { if constexpr(std::is_same<char_t, xtd::wchar>::value) chars_ = std::move(str); else chars_ = std::move(__xtd_convert_to_string<value_type>(std::move(str))); return self_; }

/ Copy assignment operator. Replaces the contents with a copy of the contents of str. /

Parameters
strString litteral pointer to use as data source. /
Exceptions
xtd::tring_null_pointer_exceptionThe `str` is null. /
Returns
This current instance. basic_string& operator =(const char* str) { if (str == null) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::null_pointer); if constexpr(std::is_same_v<char, char_t>) chars_ = std::basic_string<char>(str); else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<char>(str)); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of str. /
Parameters
strString litteral pointer to use as data source. /
Exceptions
xtd::tring_null_pointer_exceptionThe `str` is null. /
Returns
This current instance. basic_string& operator =(const xtd::char16 * str) { if (str == null) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::null_pointer); if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ = std::basic_string<xtd::char16>(str); else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char16>(str)); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of str. /
Parameters
strString litteral pointer to use as data source. /
Exceptions
xtd::tring_null_pointer_exceptionThe `str` is null. /
Returns
This current instance. basic_string& operator =(const xtd::char32 * str) { if (str == null) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::null_pointer); if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ = std::basic_string<xtd::char32>(str); else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char32>(str)); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of str. /
Parameters
strString litteral pointer to use as data source. /
Exceptions
xtd::tring_null_pointer_exceptionThe `str` is null. /
Returns
This current instance. basic_string& operator =(const xtd::char8 * str) { if (str == null) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::null_pointer); if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ = std::basic_string<xtd::char8>(str); else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::char8>(str)); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of str. /
Parameters
strString litteral pointer to use as data source. /
Exceptions
xtd::tring_null_pointer_exceptionThe `str` is null. /
Returns
This current instance. basic_string& operator =(const xtd::wchar * str) { if (str == null) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::null_pointer); if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ = std::basic_string<xtd::wchar>(str); else chars_ = __xtd_convert_to_string<value_type>(std::basic_string<xtd::wchar>(str)); return self_; }

/ Copy assignment operator. Replaces the contents with the specified character. /

Parameters
characterThe character to use as data source. /
Returns
This current instance. basic_string& operator =(char character) { self_ = basic_string(character, 1); return self_; } / Copy assignment operator. Replaces the contents with the specified character. /
Parameters
characterThe character to use as data source. /
Returns
This current instance. basic_string& operator =(xtd::char16 character) { self_ = basic_string(character, 1); return self_; } / Copy assignment operator. Replaces the contents with the specified character. /
Parameters
characterThe character to use as data source. /
Returns
This current instance. basic_string& operator =(xtd::char32 character) { self_ = basic_string(character, 1); return self_; } / Copy assignment operator. Replaces the contents with the specified character. /
Parameters
characterThe character to use as data source. /
Returns
This current instance. basic_string& operator =(xtd::char8 character) { self_ = basic_string(character, 1); return self_; } / Copy assignment operator. Replaces the contents with the specified character. /
Parameters
characterThe character to use as data source. /
Returns
This current instance. basic_string& operator =(xtd::wchar character) { self_ = basic_string(character, 1); return self_; }

/ Copy assignment operator. Replaces the contents with a copy of the contents of the specified initializer list. /

Parameters
ilThe initialiazer list to use as data source. /
Returns
This current instance. basic_string& operator =(const std::initializer_list<char>& il) { self_ = basic_string(il); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of the specified initializer list. /
Parameters
ilThe initialiazer list to use as data source. /
Returns
This current instance. basic_string& operator =(const std::initializer_list<xtd::char16>& il) { self_ = basic_string(il); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of the specified initializer list. /
Parameters
ilThe initialiazer list to use as data source. /
Returns
This current instance. basic_string& operator =(const std::initializer_list<xtd::char32>& il) { self_ = basic_string(il); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of the specified initializer list. /
Parameters
ilThe initialiazer list to use as data source. /
Returns
This current instance. basic_string& operator =(const std::initializer_list<xtd::char8>& il) { self_ = basic_string(il); return self_; } / Copy assignment operator. Replaces the contents with a copy of the contents of the specified initializer list. /
Parameters
ilThe initialiazer list to use as data source. /
Returns
This current instance. basic_string& operator =(const std::initializer_list<xtd::wchar>& il) { self_ = basic_string(il); return self_; }

/ Addition assignment operator. Appends additional characters to the string. /

Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(const basic_string<char>& str) { if constexpr(std::is_same_v<char, char_t>) chars_ += str.chars_; else chars_ += __xtd_convert_to_string<value_type>(str.chars_); return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(const basic_string<xtd::char16>& str) { if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += str.chars_; else chars_ += __xtd_convert_to_string<value_type>(str.chars_); return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(const basic_string<xtd::char32>& str) { if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += str.chars_; else chars_ += __xtd_convert_to_string<value_type>(str.chars_); return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(const basic_string<xtd::char8>& str) { if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += str.chars_; else chars_ += __xtd_convert_to_string<value_type>(str.chars_); return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(const basic_string<xtd::wchar>& str) { if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += str.chars_; else chars_ += __xtd_convert_to_string<value_type>(str.chars_); return self_; }

/ Addition assignment operator. Appends additional characters to the string. /

Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(basic_string<char>&& str) { if constexpr(std::is_same_v<char, char_t>) chars_ += std::move(str.chars_); else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_)); return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(basic_string<xtd::char16>&& str) { if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += std::move(str.chars_); else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_)); return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(basic_string<xtd::char32>&& str) { if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += std::move(str.chars_); else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_)); return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(basic_string<xtd::char8>&& str) { if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += std::move(str.chars_); else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_)); return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(basic_string<xtd::wchar>&& str) { if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += std::move(str.chars_); else chars_ += __xtd_convert_to_string<value_type>(std::move(str.chars_)); return self_; }

/ Addition assignment operator. Appends additional characters to the string. /

Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(const std::basic_string<char>& str) { if constexpr(std::is_same_v<char, char_t>) chars_ += str; else chars_ += __xtd_convert_to_string<value_type>(str); return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(const std::basic_string<xtd::char16>& str) { if constexpr(std::is_same_v<xtd::char16, char_t>) chars_ += str; else chars_ += __xtd_convert_to_string<value_type>(str); return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(const std::basic_string<xtd::char32>& str) { if constexpr(std::is_same_v<xtd::char32, char_t>) chars_ += str; else chars_ += __xtd_convert_to_string<value_type>(str); return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(const std::basic_string<xtd::char8>& str) { if constexpr(std::is_same_v<xtd::char8, char_t>) chars_ += str; else chars_ += __xtd_convert_to_string<value_type>(str); return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(const std::basic_string<xtd::wchar>& str) { if constexpr(std::is_same_v<xtd::wchar, char_t>) chars_ += str; else chars_ += __xtd_convert_to_string<value_type>(str); return self_; }

/ Addition assignment operator. Appends additional characters to the string. /

Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(const char* str) { chars_ += basic_string(str).chars_; return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(const xtd::char16 * str) { chars_.append(basic_string(str).chars_); return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(const xtd::char32 * str) { chars_ += basic_string(str).chars_; return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(const xtd::char8 * str) { chars_ += basic_string(str).chars_; return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
strstring to append. /
Returns
This current instance with characters added. basic_string& operator +=(const xtd::wchar * str) { chars_ += basic_string(str).chars_; return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
chCharacter value to append. /
Returns
This current instance with characters added. basic_string& operator +=(char ch) { chars_ += basic_string(ch, 1).chars_; return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
chCharacter value to append. /
Returns
This current instance with characters added. basic_string& operator +=(xtd::char16 ch) { chars_ += basic_string(ch, 1).chars_; return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
chCharacter value to append. /
Returns
This current instance with characters added. basic_string& operator +=(xtd::char32 ch) { chars_ += basic_string(ch, 1).chars_; return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
chCharacter value to append. /
Returns
This current instance with characters added. basic_string& operator +=(xtd::char8 ch) { chars_ += basic_string(ch, 1).chars_; return self_; } / Addition assignment operator. Appends additional characters to the string. /
Parameters
chCharacter value to append. /
Returns
This current instance with characters added. basic_string& operator +=(xtd::wchar ch) { chars_ += basic_string(ch, 1).chars_; return self_; }

/ Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /

Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const basic_string<char>& rhs) { auto result = lhs; result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char16>& rhs) { auto result = lhs; result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char32>& rhs) { auto result = lhs; result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::char8>& rhs) { auto result = lhs; result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const basic_string<xtd::wchar>& rhs) { auto result = lhs; result += rhs; return result; }

/ Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /

Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, basic_string<char>&& rhs) { auto result = std::move(lhs); result += std::move(rhs); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char16>&& rhs) { auto result = std::move(lhs); result += std::move(rhs); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char32>&& rhs) { auto result = std::move(lhs); result += std::move(rhs); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, basic_string<xtd::char8>&& rhs) { auto result = std::move(lhs); result += std::move(rhs); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, basic_string<xtd::wchar>&& rhs) { auto result = std::move(lhs); result += std::move(rhs); return result; }

/ Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /

Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, const basic_string<char>& rhs) { auto result = std::move(lhs); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char16>& rhs) { auto result = std::move(lhs); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char32>& rhs) { auto result = std::move(lhs); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::char8>& rhs) { auto result = std::move(lhs); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, const basic_string<xtd::wchar>& rhs) { auto result = std::move(lhs); result += rhs; return result; }

/ Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /

Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, basic_string<char>&& rhs) { auto result = lhs; result += std::move(rhs); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char16>&& rhs) { auto result = lhs; result += std::move(rhs); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char32>&& rhs) { auto result = lhs; result += std::move(rhs); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, basic_string<xtd::char8>&& rhs) { auto result = lhs; result += std::move(rhs); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, basic_string<xtd::wchar>&& rhs) { auto result = lhs; result += std::move(rhs); return result; }

/ Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /

Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const std::basic_string<char>& rhs) { auto result = lhs; result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char16>& rhs) { auto result = lhs; result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char32>& rhs) { auto result = lhs; result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::char8>& rhs) { auto result = lhs; result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const std::basic_string<xtd::wchar>& rhs) { auto result = lhs; result += rhs; return result; }

/ Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /

Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const std::basic_string<char>& lhs, const basic_string & rhs) { auto result = lhs; if constexpr(std::is_same_v<char, char_t>) result += rhs.chars(); else result += __xtd_convert_to_string<char>(rhs.chars()); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const std::basic_string<xtd::char16>& lhs, const basic_string & rhs) { auto result = lhs; if constexpr(std::is_same_v<xtd::char16, char_t>) result += rhs.chars(); else result += __xtd_convert_to_string<xtd::char16>(rhs.chars()); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const std::basic_string<xtd::char32>& lhs, const basic_string & rhs) { auto result = lhs; if constexpr(std::is_same_v<xtd::char32, char_t>) result += rhs.chars(); else result += __xtd_convert_to_string<xtd::char32>(rhs.chars()); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const std::basic_string<xtd::char8>& lhs, const basic_string & rhs) { auto result = lhs; if constexpr(std::is_same_v<xtd::char8, char_t>) result += rhs.chars(); else result += __xtd_convert_to_string<xtd::char8>(rhs.chars()); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const std::basic_string<xtd::wchar>& lhs, const basic_string & rhs) { auto result = lhs; if constexpr(std::is_same_v<xtd::wchar, char_t>) result += rhs.chars(); else result += __xtd_convert_to_string<xtd::wchar>(rhs.chars()); return result; }

/ Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /

Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const char* rhs) { auto result = lhs; result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const xtd::char16 * rhs) { auto result = lhs; result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const xtd::char32 * rhs) { auto result = lhs; result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const xtd::char8 * rhs) { auto result = lhs; result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const xtd::wchar * rhs) { auto result = lhs; result += rhs; return result; }

/ Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /

Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, const char* rhs) { auto result = std::move(lhs); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, const xtd::char16 * rhs) { auto result = std::move(lhs); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, const xtd::char32 * rhs) { auto result = std::move(lhs); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, const xtd::char8 * rhs) { auto result = std::move(lhs); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, const xtd::wchar * rhs) { auto result = std::move(lhs); result += rhs; return result; }

/ Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /

Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const char* lhs, const basic_string & rhs) { auto result = basic_string(lhs); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const xtd::char16 * lhs, const basic_string & rhs) { auto result = basic_string(lhs); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const xtd::char32 * lhs, const basic_string & rhs) { auto result = basic_string(lhs); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const xtd::char8 * lhs, const basic_string & rhs) { auto result = basic_string(lhs); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const xtd::wchar * lhs, const basic_string & rhs) { auto result = basic_string(lhs); result += rhs; return result; }

/ Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /

Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const char* lhs, basic_string&& rhs) { auto result = basic_string(lhs); result += std::move(rhs); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const xtd::char16 * lhs, basic_string&& rhs) { auto result = basic_string(lhs); result += std::move(rhs); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const xtd::char32 * lhs, basic_string&& rhs) { auto result = basic_string(lhs); result += std::move(rhs); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const xtd::char8 * lhs, basic_string&& rhs) { auto result = basic_string(lhs); result += std::move(rhs); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const xtd::wchar * lhs, basic_string&& rhs) { auto result = basic_string(lhs); result += std::move(rhs); return result; }

/ Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /

Parameters
lhsThe string characters who will precede the rhs. /
rhsThe character who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const char rhs) { auto result = lhs; result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe character who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const xtd::char16 rhs) { auto result = lhs; result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe character who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const xtd::char32 rhs) { auto result = lhs; result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe character who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const xtd::char8 rhs) { auto result = lhs; result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe character who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(const basic_string & lhs, const xtd::wchar rhs) { auto result = lhs; result += rhs; return result; }

/ Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /

Parameters
lhsThe string characters who will precede the rhs. /
rhsThe character who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, const char rhs) { auto result = std::move(lhs); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe character who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, const xtd::char16 rhs) { auto result = std::move(lhs); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe character who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, const xtd::char32 rhs) { auto result = std::move(lhs); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe character who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, const xtd::char8 rhs) { auto result = std::move(lhs); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe string characters who will precede the rhs. /
rhsThe character who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(basic_string&& lhs, const xtd::wchar rhs) { auto result = std::move(lhs); result += rhs; return result; }

/ Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /

Parameters
lhsThe character who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(char lhs, const basic_string & rhs) { auto result = basic_string(lhs, 1); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe character who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(xtd::char16 lhs, const basic_string & rhs) { auto result = basic_string(lhs, 1); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe character who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(xtd::char32 lhs, const basic_string & rhs) { auto result = basic_string(lhs, 1); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe character who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(xtd::char8 lhs, const basic_string & rhs) { auto result = basic_string(lhs, 1); result += rhs; return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe character who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(xtd::wchar lhs, const basic_string & rhs) { auto result = basic_string(lhs, 1); result += rhs; return result; }

/ Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /

Parameters
lhsThe character who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(char lhs, basic_string&& rhs) { auto result = basic_string(lhs, 1); result += std::move(rhs); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe character who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(xtd::char16 lhs, basic_string&& rhs) { auto result = basic_string(lhs, 1); result += std::move(rhs); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe character who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(xtd::char32 lhs, basic_string&& rhs) { auto result = basic_string(lhs, 1); result += std::move(rhs); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe character who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(xtd::char8 lhs, basic_string&& rhs) { auto result = basic_string(lhs, 1); result += std::move(rhs); return result; } / Addition operator. Returns a string containing characters from lhs followed by the characters from rhs. /
Parameters
lhsThe character who will precede the rhs. /
rhsThe string characters who will follow the lhs. /
Returns
A string containing characters from lhs followed by the characters from rhs. friend basic_string operator +(xtd::wchar lhs, basic_string&& rhs) { auto result = basic_string(lhs, 1); result += std::move(rhs); return result; }

/

Todo
uncomment following operators /

Output stream operator. Behaves as a FormattedOutputFunction. After constructing and checking the sentry object, determines the output format padding. /

Parameters
osThe character output stream. /
strThe string to be inserted. /
Remarks
Then inserts each character from the resulting sequence seq (the contents of str plus padding) to the output stream os as if by calling os.rdbuf()->sputn(seq, n), where n is std::max(os.width(), str.length()). /
Finally, calls os.width(0) to cancel the effects of std::setw, if any. /
Equivalent to return os << std::basic_string_view<char_t, traits_t>(str);. /
Todo
uncomment following line and remove the next. friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string& str) {return stream << str.to_string().chars_;} friend std::basic_ostream<char>& operator <<(std::basic_ostream<char>& stream, const basic_string & str) { if constexpr(std::is_same_v<char, char_t>) return stream << str.chars(); else return stream << __xtd_convert_to_string<char>(str.chars()); } /

Output stream operator. Behaves as a FormattedOutputFunction. After constructing and checking the sentry object, determines the output format padding. /

Parameters
osThe character output stream. /
strThe string to be inserted. /
Remarks
Then inserts each character from the resulting sequence seq (the contents of str plus padding) to the output stream os as if by calling os.rdbuf()->sputn(seq, n), where n is std::max(os.width(), str.length()). /
Finally, calls os.width(0) to cancel the effects of std::setw, if any. /
Equivalent to return os << std::basic_string_view<char_t, traits_t>(str);. friend std::basic_ostream<xtd::wchar>& operator <<(std::basic_ostream<xtd::wchar>& stream, const basic_string & str) {return stream << str.to_wstring().chars();}

/ Input stream operator. Behaves as a FormattedInputFunction. After constructing and checking the sentry object, which may skip leading whitespace, first clears str with str.erase(), then reads characters from is and appends them to str as if by str.append(1, c), until one of the following conditions becomes true: / * N characters are read, where N is is.width() if is.width() > 0, otherwise N is str.max_size(), / * the end-of-file condition occurs in the stream is, or / * std::isspace(c, is.getloc()) is true for the next character c in is (this whitespace character remains in the input stream). /

Parameters
isThe character input stream. /
strThe string to be extracted. /
Remarks
If no characters are extracted then std::ios::failbit is set on is, which may throw std::ios_base::failure. /
Finally, calls is.width(0) to cancel the effects of std::setw, if any. friend std::basic_istream<char>& operator >>(std::basic_istream<char>& stream, basic_string & str) { auto s = std::basic_string<char> {}; stream >> s; str = s; return stream; } / Input stream operator. Behaves as a FormattedInputFunction. After constructing and checking the sentry object, which may skip leading whitespace, first clears str with str.erase(), then reads characters from is and appends them to str as if by str.append(1, c), until one of the following conditions becomes true: / * N characters are read, where N is is.width() if is.width() > 0, otherwise N is str.max_size(), / * the end-of-file condition occurs in the stream is, or / * std::isspace(c, is.getloc()) is true for the next character c in is (this whitespace character remains in the input stream). /
Parameters
isThe character input stream. /
strThe string to be extracted. /
Remarks
If no characters are extracted then std::ios::failbit is set on is, which may throw std::ios_base::failure. /
Finally, calls is.width(0) to cancel the effects of std::setw, if any. friend std::basic_istream<xtd::wchar>& operator >>(std::basic_istream<xtd::wchar>& stream, basic_string & str) { auto s = std::basic_string<xtd::wchar> {}; stream >> s; str = s; return stream; } /
bool is_empty () const noexcept
 Indicates whether this basic_string is an empty basic_string (""). /.
 

Additional Inherited Members

using value_type
 Represents the xtd::collections::generic::ienumerable value type.
 
using iterator
 Represents the iterator of xtd::collections::generic::ienumerable value type.
 
using const_iterator
 Represents the const iterator of xtd::collections::generic::ienumerable value type.
 
using iterator
 Represents the iterator of enumerable value type.
 
using const_iterator
 Represents the const iterator of enumerable value type.
 
using enumerable_type
 Represents the ienumerable enumerable type.
 
using source_type
 Represents the ienumerable source type.
 
using ienumerable
 Represents the ienumerable value type.
 
using list
 Represents the list value type.
 
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
virtual xtd::size get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<class object_t>
xtd::unique_ptr_object< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
virtual xtd::string to_string () const
 Returns a xtd::string that represents the current object.
 
virtual int32 compare_to (const basic_string< char_t, traits_t, allocator_t > &obj) const noexcept=0
 Compares the current instance with another object of the same type.
 
virtual bool equals (const basic_string< char_t, traits_t, allocator_t > &) const noexcept=0
 Indicates whether the current object is equal to another object of the same type.
 
virtual auto get_enumerator () const -> xtd::collections::generic::enumerator< char_t >=0
 Returns an enumerator that iterates through a collection.
 
virtual auto begin () const -> const_iterator
 Returns an iterator to the first element of the enumerable.
 
virtual auto begin () -> iterator
 Returns an iterator to the first element of the enumerable.
 
virtual auto cbegin () const -> const_iterator
 Returns an iterator to the first element of the enumerable.
 
virtual auto cend () const -> const_iterator
 Returns an iterator to the element following the last element of the enumerable.
 
virtual auto end () const -> const_iterator
 Returns an iterator to the element following the last element of the enumerable.
 
virtual auto end () -> iterator
 Returns an iterator to the element following the last element of the enumerable.
 
auto aggregate (const std::function< char_t(const char_t &, const char_t &)> &func) const -> char_t
 Applies an accumulator function over a sequence.
 
auto aggregate (const char_t &seed, const std::function< char_t(const char_t &, const char_t &)> &func) const -> char_t
 Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.
 
auto aggregate (const accumulate_t &seed, const std::function< accumulate_t(const accumulate_t &, const char_t &)> &func) const -> accumulate_t
 Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.
 
auto aggregate (const char_t &seed, const std::function< char_t(const char_t &, const char_t &)> &func, const std::function< char_t(const char_t &)> &result_selector) const -> char_t
 Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.
 
auto aggregate (const accumulate_t &seed, const std::function< accumulate_t(const accumulate_t &, const char_t &)> &func, const std::function< result_t(const accumulate_t &)> &result_selector) const -> result_t
 Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.
 
auto all (const std::function< bool(const char_t &)> &predicate) const -> bool
 Determines whether all elements of a sequence satisfy a condition.
 
auto any () const noexcept -> bool
 Determines whether a sequence contains any elements.
 
auto any (const std::function< bool(const char_t &)> &predicate) const -> bool
 Determines whether any element of a sequence satisfies a condition.
 
auto append (const char_t &element) const noexcept
 Appends a value to the end of the sequence.
 
auto as_enumerable () const noexcept
 Returns the input typed as xtd::collections::generic::ienumerable <type_t>.
 
auto average () const noexcept
 Computes the average of a sequence of source_t values.
 
auto cast () const noexcept
 Casts the elements of an xtd::collections::generic::ienumerable to the specified type.
 
auto chunk (xtd::size size) const
 Splits the elements of a sequence into chunks of size at most size.
 
auto concat (const ienumerable< char_t > &second) const noexcept
 Concatenates two sequences.
 
auto contains (const char_t &value) const noexcept -> bool
 Determines whether a sequence contains a specified element by using the default equality comparer.
 
auto contains (const char_t &value, const xtd::collections::generic::iequality_comparer< char_t > &comparer) const noexcept -> bool
 Determines whether a sequence contains a specified element by using a specified equality comparer.
 
auto count () const noexcept -> xtd::size
 Returns the number of elements in current sequence.
 
auto count (const std::function< bool(const char_t &)> &predicate) const noexcept -> xtd::size
 Returns a number that represents how many elements in the specified sequence satisfy a condition.
 
auto count (const char_t &value) const noexcept -> xtd::size
 Returns the number of elements with the specified value.
 
auto count_by (const std::function< key_t(const char_t &)> &key_selector) const noexcept
 Returns the count of elements in the current sequence grouped by key.
 
auto count_by (const std::function< key_t(const char_t &)> &key_selector, const xtd::collections::generic::iequality_comparer< key_t > &key_comparer) const noexcept
 Returns the count of elements in the current sequence grouped by key.
 
auto default_if_empty () const noexcept
 Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the current sequence is empty.
 
auto default_if_empty (const char_t &default_value) const noexcept
 Returns the elements of the specified sequence or the specified value in a singleton collection if the current sequence is empty.
 
auto distinct () const noexcept
 Returns distinct elements from a sequence by using the default equality comparer to compare values.
 
auto distinct (const xtd::collections::generic::iequality_comparer< char_t > &comparer) const noexcept
 Returns distinct elements from a sequence by using a specified xtd::collections::generic::iequality_comparer <type_t> to compare values.
 
auto first_or_default (const std::function< bool(const char_t &)> &predicate, const char_t &default_value) const noexcept -> char_t
 Returns the first element of the sequence that satisfies a condition, or a specified default value if no such element is found.
 
auto first_or_default (const std::function< bool(const char_t &)> &predicate) const noexcept -> char_t
 Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.
 
auto first_or_default (const char_t default_value) const noexcept -> char_t
 Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.
 
auto first_or_default () const noexcept -> char_t
 Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.
 
auto order ()
 Sorts the elements of a sequence in ascending order.
 
auto order (const xtd::collections::generic::icomparer< char_t > &comparer)
 Sorts the elements of a sequence in ascending order.
 
auto order_by (const std::function< char_t(const char_t &)> &key_selector) const
 Sorts the elements of a sequence in ascending order according to a key.
 
auto order_by (const std::function< key_t(const char_t &)> &key_selector) const
 Sorts the elements of a sequence in ascending order according to a key.
 
auto order_by_descending (const std::function< key_t(const char_t &)> &key_selector) const
 Sorts the elements of a sequence in descending order according to a key.
 
auto order_by_descending (const std::function< char_t(const char_t &)> &key_selector) const
 Sorts the elements of a sequence in descending order according to a key.
 
auto select (const std::function< result_t(const char_t &)> &selector) const
 Projects each element of a sequence into a new form.
 
auto select (const std::function< char_t(const char_t &)> &selector) const
 Projects each element of a sequence into a new form.
 
auto select (const std::function< result_t(const char_t &, xtd::size index)> &selector) const
 Projects each element of a sequence into a new form by incorporating the element's index.
 
auto select (const std::function< char_t(const char_t &, xtd::size index)> &selector) const
 Projects each element of a sequence into a new form by incorporating the element's index.
 
auto to_array () const noexcept -> xtd::array< char_t >
 Creates a xtd::array <type_t> from an xtd::collections::generic::ienumerable <type_t>.
 
auto to_list () const noexcept -> xtd::collections::generic::list< char_t >
 Creates a xtd::collections::generic::list <type_t> from an xtd::collections::generic::ienumerable <type_t>.
 
auto where (const std::function< bool(const char_t &)> &predicate) const
 Filters a sequence of values based on a predicate.
 
auto where (const std::function< bool(const char_t &, xtd::size)> &predicate) const
 Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function.
 

Member Typedef Documentation

◆ base_type

template<class char_t, class traits_t, class allocator_t>
using xtd::basic_string< char_t, traits_t, allocator_t >::base_type

Represents the basic string base type.

Remarks
Is equal to std::basic_string<char_t, traits_t, allocator_t>.

◆ traits_type

template<class char_t, class traits_t, class allocator_t>
using xtd::basic_string< char_t, traits_t, allocator_t >::traits_type

Represents the basic string traits type.

◆ value_type

template<class char_t, class traits_t, class allocator_t>
using xtd::basic_string< char_t, traits_t, allocator_t >::value_type

Represents the basic string value type.

◆ allocator_type

template<class char_t, class traits_t, class allocator_t>
using xtd::basic_string< char_t, traits_t, allocator_t >::allocator_type

Represents the basic string allocator type.

◆ size_type

template<class char_t, class traits_t, class allocator_t>
using xtd::basic_string< char_t, traits_t, allocator_t >::size_type

Represents the basic string size type.

◆ difference_type

template<class char_t, class traits_t, class allocator_t>
using xtd::basic_string< char_t, traits_t, allocator_t >::difference_type

Represents the basic string difference type.

◆ reference

template<class char_t, class traits_t, class allocator_t>
using xtd::basic_string< char_t, traits_t, allocator_t >::reference

Represents the basic string referecne type.

◆ const_reference

template<class char_t, class traits_t, class allocator_t>
using xtd::basic_string< char_t, traits_t, allocator_t >::const_reference

Represents the basic string const referecne type.

◆ pointer

template<class char_t, class traits_t, class allocator_t>
using xtd::basic_string< char_t, traits_t, allocator_t >::pointer

Represents the basic string pointer type.

◆ const_pointer

template<class char_t, class traits_t, class allocator_t>
using xtd::basic_string< char_t, traits_t, allocator_t >::const_pointer

Represents the basic string const pointer type.

◆ iterator

template<class char_t, class traits_t, class allocator_t>
using xtd::basic_string< char_t, traits_t, allocator_t >::iterator

Represents the basic string iterator type.

Todo
replace xtd::ienumerable::iterator

◆ const_iterator

template<class char_t, class traits_t, class allocator_t>
using xtd::basic_string< char_t, traits_t, allocator_t >::const_iterator

Represents the basic string const iterator type.

Todo
replace xtd::ienumerable::const_iterator

◆ reverse_iterator

template<class char_t, class traits_t, class allocator_t>
using xtd::basic_string< char_t, traits_t, allocator_t >::reverse_iterator

Represents the basic string reverse iterator type.

◆ const_reverse_iterator

template<class char_t, class traits_t, class allocator_t>
using xtd::basic_string< char_t, traits_t, allocator_t >::const_reverse_iterator

Represents the basic string const reverse iterator type.

◆ enumerator_type

template<class char_t, class traits_t, class allocator_t>
using xtd::basic_string< char_t, traits_t, allocator_t >::enumerator_type

Represents the basic string enumerator type.

Constructor & Destructor Documentation

◆ basic_string() [1/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( )
default

Initializes a new instance of xtd::basic_string.

◆ basic_string() [2/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( basic_string< char_t, traits_t, allocator_t > && )
default

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

Parameters
strThe basic_string to move.

◆ basic_string() [3/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( std::basic_string< char_t > && str)
inline

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

Parameters
strThe basic_string to move.

◆ basic_string() [4/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const basic_string< char > & str)
inlinenoexcept

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

Parameters
strThe string to copy.

◆ basic_string() [5/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const basic_string< xtd::char16 > & str)
inlinenoexcept

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

Parameters
strThe string to copy.

◆ basic_string() [6/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const basic_string< xtd::char32 > & str)
inlinenoexcept

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

Parameters
strThe string to copy.

◆ basic_string() [7/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const basic_string< xtd::char8 > & str)
inlinenoexcept

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

Parameters
strThe string to copy.

◆ basic_string() [8/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const basic_string< xtd::wchar > & str)
inlinenoexcept

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

Parameters
strThe string to copy.

◆ basic_string() [9/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const std::basic_string< char > & str)
inlinenoexcept

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

Parameters
strThe string to copy.

◆ basic_string() [10/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const std::basic_string< xtd::char16 > & str)
inlinenoexcept

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

Parameters
strThe string to copy.

◆ basic_string() [11/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const std::basic_string< xtd::char32 > & str)
inlinenoexcept

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

Parameters
strThe string to copy.

◆ basic_string() [12/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const std::basic_string< xtd::char8 > & str)
inlinenoexcept

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

Parameters
strThe string to copy.

◆ basic_string() [13/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const std::basic_string< xtd::wchar > & str)
inlinenoexcept

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

Parameters
strThe string to copy.

◆ basic_string() [14/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( char character,
xtd::size count )
inline

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

Parameters
characterThe character copied.
countThe number of copies of character.

◆ basic_string() [15/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( xtd::char16 character,
xtd::size count )
inline

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

Parameters
characterThe character copied.
countThe number of copies of character.

◆ basic_string() [16/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( xtd::char32 character,
xtd::size count )
inline

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

Parameters
characterThe character copied.
countThe number of copies of character.

◆ basic_string() [17/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( xtd::char8 character,
xtd::size count )
inline

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

Parameters
characterThe character copied.
countThe number of copies of character.

◆ basic_string() [18/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( xtd::wchar character,
xtd::size count )
inline

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

Parameters
characterThe character copied.
countThe number of copies of character.

◆ basic_string() [19/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const char * str)
inline

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

Parameters
strThe string to copy.

◆ basic_string() [20/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const xtd::char16 * str)
inline

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

Parameters
strThe string to copy.

◆ basic_string() [21/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const xtd::char32 * str)
inline

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

Parameters
strThe string to copy.

◆ basic_string() [22/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const xtd::char8 * str)
inline

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

Parameters
strThe string to copy.

◆ basic_string() [23/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const xtd::wchar * str)
inline

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

Parameters
strThe string to copy.

◆ basic_string() [24/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const char * str,
xtd::size count )
inline

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

Parameters
countThe number of substring characters to copy.

◆ basic_string() [25/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const xtd::char16 * str,
xtd::size count )
inline

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

Parameters
countThe number of substring characters to copy.

◆ basic_string() [26/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const xtd::char32 * str,
xtd::size count )
inline

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

Parameters
countThe number of substring characters to copy.

◆ basic_string() [27/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const xtd::char8 * str,
xtd::size count )
inline

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

Parameters
countThe number of substring characters to copy.

◆ basic_string() [28/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const xtd::wchar * str,
xtd::size count )
inline

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

Parameters
countThe number of substring characters to copy.

◆ basic_string() [29/35]

template<class char_t, class traits_t, class allocator_t>
template<class input_iterator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( input_iterator_t first,
input_iterator_t last )
inline

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

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

◆ basic_string() [30/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( const std::basic_string_view< char_t > & str)
inline

Initializes a new instance of xtd::basic_string with specified std::basic_string_view.

Parameters
strThe std::basic_string_view string.

◆ basic_string() [31/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( std::initializer_list< char > il)
inline

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

Parameters
ilThe initializer list to fill.

◆ basic_string() [32/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( std::initializer_list< xtd::char16 > il)
inline

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

Parameters
ilThe initializer list to fill.

◆ basic_string() [33/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( std::initializer_list< xtd::char32 > il)
inline

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

Parameters
ilThe initializer list to fill.

◆ basic_string() [34/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( std::initializer_list< xtd::char8 > il)
inline

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

Parameters
ilThe initializer list to fill.

◆ basic_string() [35/35]

template<class char_t, class traits_t, class allocator_t>
xtd::basic_string< char_t, traits_t, allocator_t >::basic_string ( std::initializer_list< xtd::wchar > il)
inline

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

Parameters
ilThe initializer list to fill.

Member Function Documentation

◆ c_str()

template<class char_t, class traits_t, class allocator_t>
const_pointer xtd::basic_string< char_t, traits_t, allocator_t >::c_str ( ) const
inlinenoexcept

Returns a pointer to a null-terminated character array with data equivalent to those stored in the string.

Returns
Pointer to the underlying character storage.
Remarks
The pointer is such that the range [c_str(), c_str() + size()] is valid and the values in it correspond to the values stored in the string with an additional null character after the last position.
The pointer obtained from c_str() may be invalidated by:
Writing to the character array accessed through c_str() is undefined behavior.
c_str() and data() perform the same function.

◆ chars() [1/2]

template<class char_t, class traits_t, class allocator_t>
const base_type & xtd::basic_string< char_t, traits_t, allocator_t >::chars ( ) const
inlinenoexcept

Returns a reference to the underlying base type.

Returns
Reference to the underlying base type.

◆ chars() [2/2]

template<class char_t, class traits_t, class allocator_t>
base_type & xtd::basic_string< char_t, traits_t, allocator_t >::chars ( )
inlinenoexcept

Returns a reference to the underlying base type.

Returns
Reference to the underlying base type.

◆ count()

template<class char_t, class traits_t, class allocator_t>
virtual size_type xtd::basic_string< char_t, traits_t, allocator_t >::count ( ) const
inlinevirtualnoexcept

Gets the number of characters in the current xtd::basic_string object.

Returns
The number of characters in the current string.
Remarks
The xtd::basic_string::length property returns the number of xtd::basic_string::value_type objects in this instance, not the number of Unicode characters. The reason is that a Unicode character might be represented by more than one xtd::basic_string::value_type.

◆ data()

template<class char_t, class traits_t, class allocator_t>
const_pointer xtd::basic_string< char_t, traits_t, allocator_t >::data ( ) const
inlinenoexcept

Returns a pointer to the underlying array serving as character storage. The pointer is such that the range [data(), data() + size()] is valid and the values in it correspond to the values stored in the string.

Returns
A pointer to the underlying character storage.
Remarks
The pointer obtained from data() may be invalidated by:
  • Passing a non-const reference to the string to any standard library function, or
  • Calling non-const member functions on the string, excluding operator[](), at(), front(), back(), begin(), end(), rbegin(), rend().
    1. Modifying the character array accessed through the const overload of data has undefined behavior.
    2. Modifying the past-the-end null terminator stored at data() + size() to any value other than char_t() has undefined behavior.

◆ empty()

template<class char_t, class traits_t, class allocator_t>
virtual bool xtd::basic_string< char_t, traits_t, allocator_t >::empty ( ) const
inlinevirtualnoexcept

Checks whether the container is empty.

Returns
true if container is empty; otherwise false.

◆ length()

template<class char_t, class traits_t, class allocator_t>
virtual size_type xtd::basic_string< char_t, traits_t, allocator_t >::length ( ) const
inlinevirtualnoexcept

Gets the number of characters in the current xtd::basic_string object.

Returns
The number of characters in the current string.
Remarks
The xtd::basic_string::length property returns the number of xtd::basic_string::value_type objects in this instance, not the number of Unicode characters. The reason is that a Unicode character might be represented by more than one xtd::basic_string::value_type.

◆ size()

template<class char_t, class traits_t, class allocator_t>
virtual size_type xtd::basic_string< char_t, traits_t, allocator_t >::size ( ) const
inlinevirtualnoexcept

Gets the number of characters in the current xtd::basic_string object.

Returns
The number of characters in the current string.
Remarks
The xtd::basic_string::length property returns the number of xtd::basic_string::value_type objects in this instance, not the number of Unicode characters. The reason is that a Unicode character might be represented by more than one xtd::basic_string::value_type.

◆ compare() [1/5]

template<class char_t, class traits_t, class allocator_t>
int32 xtd::basic_string< char_t, traits_t, allocator_t >::compare ( const basic_string< char_t, traits_t, allocator_t > & str) const
inline

Compares two character sequences.

Parameters
strThe other string to compare to.
Returns
A 32-bit signed integer that indicates whether this instance precedes, follows, or appears in the same position in the sort order as the value parameter:
  • Negative value if *this appears before the character sequence specified by the arguments, in lexicographical order.
  • Zero if both character sequences compare equivalent.
  • Positive value if *this appears after the character sequence specified by the arguments, in lexicographical order.
Remarks
Compares this string to str.
A character sequence consisting of count1 characters starting at data1 is compared to a character sequence consisting of count2 characters starting at data2 as follows:
  • First, calculate the number of characters to compare, as if by size_type rlen = std::min(count1, count2).
  • Then compare the sequences by calling traits_t::compare(data1, data2, rlen). For standard strings this function performs character-by-character lexicographical comparison. If the result is zero (the character sequences are equal so far), then their sizes are compared as follows:
Condition Result Return value
traits_t::compare(data1, data2, rlen) < 0 data1 is less than data2 < 0
traits_t::compare(data1, data2, rlen) == 0 and size1 < size2 data1 is less than data2 < 0
traits_t::compare(data1, data2, rlen) == 0 and size1 == size2 data1 is equal to data2 0
traits_t::compare(data1, data2, rlen) == 0 and size1 > size2 data1 is greater than data2 > 0
traits_t::compare(data1, data2, rlen) > 0 data1 is greater than data2 > 0

◆ compare() [2/5]

template<class char_t, class traits_t, class allocator_t>
int32 xtd::basic_string< char_t, traits_t, allocator_t >::compare ( size_type pos1,
size_type count1,
const basic_string< char_t, traits_t, allocator_t > & str ) const
inline

Compares two character sequences.

Parameters
pos1The position of the first character in this string to compare.
count1The number of characters of this string to compare.
strThe other string to compare to.
Returns
A 32-bit signed integer that indicates whether this instance precedes, follows, or appears in the same position in the sort order as the value parameter:
  • Negative value if *this appears before the character sequence specified by the arguments, in lexicographical order.
  • Zero if both character sequences compare equivalent.
  • Positive value if *this appears after the character sequence specified by the arguments, in lexicographical order.
Remarks
Compares a [pos1, pos1 + count1) substring of this string to str.
  • If count1 > size() - pos1, the substring is [pos1, size()).
A character sequence consisting of count1 characters starting at data1 is compared to a character sequence consisting of count2 characters starting at data2 as follows:
  • First, calculate the number of characters to compare, as if by size_type rlen = std::min(count1, count2).
  • Then compare the sequences by calling traits_t::compare(data1, data2, rlen). For standard strings this function performs character-by-character lexicographical comparison. If the result is zero (the character sequences are equal so far), then their sizes are compared as follows:
Condition Result Return value
traits_t::compare(data1, data2, rlen) < 0 data1 is less than data2 < 0
traits_t::compare(data1, data2, rlen) == 0 and size1 < size2 data1 is less than data2 < 0
traits_t::compare(data1, data2, rlen) == 0 and size1 == size2 data1 is equal to data2 0
traits_t::compare(data1, data2, rlen) == 0 and size1 > size2 data1 is greater than data2 > 0
traits_t::compare(data1, data2, rlen) > 0 data1 is greater than data2 > 0

◆ compare() [3/5]

template<class char_t, class traits_t, class allocator_t>
int32 xtd::basic_string< char_t, traits_t, allocator_t >::compare ( size_type pos1,
size_type count1,
const basic_string< char_t, traits_t, allocator_t > & str,
size_type pos2 ) const
inline

Compares two character sequences.

Parameters
pos1The position of the first character in this string to compare.
count1The number of characters of this string to compare.
strThe other string to compare to.
pos2The position of the first character of the given string to compare.
Returns
A 32-bit signed integer that indicates whether this instance precedes, follows, or appears in the same position in the sort order as the value parameter:
  • Negative value if *this appears before the character sequence specified by the arguments, in lexicographical order.
  • Zero if both character sequences compare equivalent.
  • Positive value if *this appears after the character sequence specified by the arguments, in lexicographical order.
Remarks
Compares a [pos1, pos1 + count1) substring of this string to a substring [pos2, pos2 + count2) of str.
  • If count1 > length() - pos1, the first substring is [pos1, length()).
  • If count2 > str.length() - pos2, the second substring is [pos2, str.length()).
A character sequence consisting of count1 characters starting at data1 is compared to a character sequence consisting of count2 characters starting at data2 as follows:
  • First, calculate the number of characters to compare, as if by size_type rlen = std::min(count1, count2).
  • Then compare the sequences by calling traits_t::compare(data1, data2, rlen). For standard strings this function performs character-by-character lexicographical comparison. If the result is zero (the character sequences are equal so far), then their sizes are compared as follows:
Condition Result Return value
traits_t::compare(data1, data2, rlen) < 0 data1 is less than data2 < 0
traits_t::compare(data1, data2, rlen) == 0 and size1 < size2 data1 is less than data2 < 0
traits_t::compare(data1, data2, rlen) == 0 and size1 == size2 data1 is equal to data2 0
traits_t::compare(data1, data2, rlen) == 0 and size1 > size2 data1 is greater than data2 > 0
traits_t::compare(data1, data2, rlen) > 0 data1 is greater than data2 > 0

◆ compare() [4/5]

template<class char_t, class traits_t, class allocator_t>
int32 xtd::basic_string< char_t, traits_t, allocator_t >::compare ( size_type pos1,
size_type count1,
const basic_string< char_t, traits_t, allocator_t > & str,
size_type pos2,
size_type count2 ) const
inline

Compares two character sequences.

Parameters
pos1The position of the first character in this string to compare.
count1The number of characters of this string to compare.
strThe other string to compare to.
pos2The position of the first character of the given string to compare.
count2The number of characters of the given string to compare.
Returns
A 32-bit signed integer that indicates whether this instance precedes, follows, or appears in the same position in the sort order as the value parameter:
  • Negative value if *this appears before the character sequence specified by the arguments, in lexicographical order.
  • Zero if both character sequences compare equivalent.
  • Positive value if *this appears after the character sequence specified by the arguments, in lexicographical order.
Remarks
Compares a [pos1, pos1 + count1) substring of this string to a substring [pos2, pos2 + count2) of str.
  • If count1 > length() - pos1, the first substring is [pos1, length()).
  • If count2 > str.length() - pos2, the second substring is [pos2, str.length()).
A character sequence consisting of count1 characters starting at data1 is compared to a character sequence consisting of count2 characters starting at data2 as follows:
  • First, calculate the number of characters to compare, as if by size_type rlen = std::min(count1, count2).
  • Then compare the sequences by calling traits_t::compare(data1, data2, rlen). For standard strings this function performs character-by-character lexicographical comparison. If the result is zero (the character sequences are equal so far), then their sizes are compared as follows:
Condition Result Return value
traits_t::compare(data1, data2, rlen) < 0 data1 is less than data2 < 0
traits_t::compare(data1, data2, rlen) == 0 and size1 < size2 data1 is less than data2 < 0
traits_t::compare(data1, data2, rlen) == 0 and size1 == size2 data1 is equal to data2 0
traits_t::compare(data1, data2, rlen) == 0 and size1 > size2 data1 is greater than data2 > 0
traits_t::compare(data1, data2, rlen) > 0 data1 is greater than data2 > 0

◆ compare() [5/5]

template<class char_t, class traits_t, class allocator_t>
int32 xtd::basic_string< char_t, traits_t, allocator_t >::compare ( const_pointer s) const
inline

Compares two character sequences.

Parameters
spointer to the character string to compare to.
Returns
A 32-bit signed integer that indicates whether this instance precedes, follows, or appears in the same position in the sort order as the value parameter:
  • Negative value if *this appears before the character sequence specified by the arguments, in lexicographical order.
  • Zero if both character sequences compare equivalent.
  • Positive value if *this appears after the character sequence specified by the arguments, in lexicographical order.
Remarks
Compares this string to the null-terminated character sequence beginning at the character pointed to by s with length traits_t::length(s).
A character sequence consisting of count1 characters starting at data1 is compared to a character sequence consisting of count2 characters starting at data2 as follows:
  • First, calculate the number of characters to compare, as if by size_type rlen = std::min(count1, count2).
  • Then compare the sequences by calling traits_t::compare(data1, data2, rlen). For standard strings this function performs character-by-character lexicographical comparison. If the result is zero (the character sequences are equal so far), then their sizes are compared as follows:
Condition Result Return value
traits_t::compare(data1, data2, rlen) < 0 data1 is less than data2 < 0
traits_t::compare(data1, data2, rlen) == 0 and size1 < size2 data1 is less than data2 < 0
traits_t::compare(data1, data2, rlen) == 0 and size1 == size2 data1 is equal to data2 0
traits_t::compare(data1, data2, rlen) == 0 and size1 > size2 data1 is greater than data2 > 0
traits_t::compare(data1, data2, rlen) > 0 data1 is greater than data2 > 0

◆ is_empty()

template<class char_t, class traits_t, class allocator_t>
bool xtd::basic_string< char_t, traits_t, allocator_t >::is_empty ( ) const
inlinenoexcept

Indicates whether this basic_string is an empty basic_string (""). /.

/ Name Public Deprecated Methods

/

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

◆ class_name() [1/3]

template<class char_t, class traits_t, class allocator_t>
template<class object_t>
static basic_string xtd::basic_string< char_t, traits_t, allocator_t >::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 basic_string type is basic_string.
Deprecated
Replaced by typeof_<object_t>().name() - Will be removed in version 0.4.0.

Name Public Deprecated Static Methods

◆ class_name() [2/3]

template<class char_t, class traits_t, class allocator_t>
template<class object_t>
static basic_string xtd::basic_string< char_t, traits_t, allocator_t >::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 basic_string type is basic_string.
Deprecated
Replaced by typeof_(object).name() - Will be removed in version 0.4.0.

◆ class_name() [3/3]

template<class char_t, class traits_t, class allocator_t>
static basic_string xtd::basic_string< char_t, traits_t, allocator_t >::class_name ( const std::type_info & info)
inlinestatic

Gets the class name of the specified object.

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

◆ full_class_name() [1/3]

template<class char_t, class traits_t, class allocator_t>
template<class object_t>
static basic_string xtd::basic_string< char_t, traits_t, allocator_t >::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 basic_string type is xtd::basic_string.
Deprecated
Replaced by typeof_<object_t>().full_name() - Will be removed in version 0.4.0.

◆ full_class_name() [2/3]

template<class char_t, class traits_t, class allocator_t>
template<class object_t>
static basic_string xtd::basic_string< char_t, traits_t, allocator_t >::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 basic_string type is xtd::basic_string.
Deprecated
Replaced by typeof_(object).full_name() - Will be removed in version 0.4.0.

◆ full_class_name() [3/3]

template<class char_t, class traits_t, class allocator_t>
static basic_string xtd::basic_string< char_t, traits_t, allocator_t >::full_class_name ( const std::type_info & info)
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 basic_string type is xtd::basic_string.
Deprecated
Replaced by typeof_(info).full_name() - Will be removed in version 0.4.0.

Member Data Documentation

◆ empty_string

template<class char_t, class traits_t, class allocator_t>
const basic_string xtd::basic_string< char_t, traits_t, allocator_t >::empty_string
static

Represents the empty basic_string.

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

◆ npos

template<class char_t, class traits_t, class allocator_t>
size_type xtd::basic_string< char_t, traits_t, allocator_t >::npos
inlinestaticconstexpr

Represents a value that is not a valid position in a collection.

Remarks
This constant is typically used to indicate the absence of an index or a failed search operation. It is equivalent to the maximum value of xtd::size.
Examples
auto str = string {"hello"};
if (str.index_of('g') == str.npos)
console::write_line("Value not found");
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...

◆ bpos

template<class char_t, class traits_t, class allocator_t>
xtd::size xtd::basic_string< char_t, traits_t, allocator_t >::bpos
inlinestaticconstexpr

Represents the index of the first valid element in a collection.

Remarks
Unlike xtd::npos (which means "no position"), xtd::bpos points to the first accessible element of a collection. It is equivalent to 0.
Examples
auto str = string {"hello"};
console::write_line(str[bpos]); // Prints 'h'
console::write_line(str[bpos + 1]); // Prints 'e'
constexpr xtd::size bpos
Represents the index of the firsy valid element in a collection.
Definition bpos.hpp:25

◆ epos

template<class char_t, class traits_t, class allocator_t>
xtd::size xtd::basic_string< char_t, traits_t, allocator_t >::epos
inlinestaticconstexpr

Represents the index of the last valid element in a collection.

Remarks
Unlike xtd::npos (which means "no position"), xtd::epos points to the last accessible element of a collection. It is equivalent to items.count() - 1.
Note
This constant is provided for readability and convenience. For example, items[xtd::epos] directly accesses the last element without manually subtracting one from the collection count.
Remarks
The epos is equivalent to ~1_z. With bitwise operator the code is more concise.
Examples
auto str = string {"hello"};
console::write_line(str[epos]); // Prints 'o'
console::write_line(str[epos - 1]); // Prints 'l'
constexpr xtd::size epos
Represents the index of the last valid element in a collection.
Definition epos.hpp:33
The wollowing exemple shows the same example with bitwise operator as index.
auto str = string {"hello"};
console::write_line(str[~1_z]); // Prints 'o'
console::write_line(str[~2_z]); // Prints 'l'

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