You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/xtd.core/include/xtd/string_comparer.hpp
+81-4Lines changed: 81 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -24,12 +24,51 @@ namespace xtd {
24
24
/// xtd
25
25
/// @par Library
26
26
/// xtd.core
27
-
/// @ingroup xtd_core
27
+
/// @ingroup xtd_core system
28
28
classstring_comparer : publicxtd::object, public xtd::collections::generic::icomparer<xtd::string>, public xtd::collections::generic::iequality_comparer<xtd::string> {
29
29
public:
30
30
/// @name Public Static Properties
31
31
32
32
/// @{
33
+
/// @brief Gets a xtd::string_comparer object that performs a case-sensitive string comparison using the word comparison rules of the current culture.
34
+
/// @return A xtd::string_comparer object.
35
+
/// @remarks The xtd::string_comparer returned by the xtd::string_comparer::current_culture property can be used when strings are linguistically relevant. For example, if strings are displayed to the user, or if strings are the result of user interaction, culture-sensitive string comparison should be used to order the string data.
36
+
/// @remarks The current culture is the xtd::globalization::culture_info object associated with the current thread.
37
+
/// @remarks The xtd::::string_comparer::current_culture property actually returns an instance of an anonymous class derived from the ::string_comparer class.
38
+
/// @remarks Each call to the ::string_comparer::current_culture property get accessor returns a new ::string_comparer object, as the following code shows.
/// @remarks To improve performance, you can store the xtd::string_comparer object in a local variable rather than retrieve the value of the xtd::string_comparer::current_culture property multiple times.
48
+
static string_comparer current_culture();
49
+
50
+
/// @brief Gets a xtd::string_comparer object that performs case-insensitive string comparisons using the word comparison rules of the current culture.
51
+
/// @return A xtd::string_comparer object.
52
+
/// @remarks The current culture is the xtd::globalization::culture_info object associated with the current thread; it is returned by the xtd::globalization::culture_info::current_culture property.
53
+
/// @remarks The xtd::string_comparer returned by the xtd::string_comparer::current_culture_ignore_case property can be used when strings are linguistically relevant but their case is not. For example, if strings are displayed to the user but case is unimportant, culture-sensitive, case-insensitive string comparison should be used to order the string data.
54
+
/// @note xtd running on Linux and macOS systems only: The collation behavior for the C and Posix cultures is always case-sensitive because these cultures do not use the expected Unicode collation order. We recommend that you use a culture other than C or Posix for performing culture-sensitive, case-insensitive sorting operations.
55
+
/// @remarks The xtd::string_comparer::current_culture_ignore_case property actually returns an instance of an anonymous class derived from the xtd::string_comparer class.
56
+
/// @remarks Each call to the xtd::string_comparer::current_culture_ignore_case property get accessor returns a new xtd::string_comparer object, as the following code shows.
/// @remarks To improve performance, you can store the xtd::string_comparer object in a local variable rather than retrieve the value of the xtd::string_comparer::current_culture_ignore_case property multiple times.
/// @brief Gets a xtd::string_comparer object that performs a case-sensitive ordinal string comparison.
34
73
/// @return A xtd::string_comparer object.
35
74
/// @remarks The xtd::string_comparer returned by the xtd::string_comparer::ordinal property performs a simple byte comparison that is independent of language. This is most appropriate when comparing strings that are generated programmatically or when comparing case-sensitive resources such as passwords.
@@ -84,7 +123,14 @@ namespace xtd {
84
123
/// @remarks The xtd::string_comparer::compare(const string&, const string&) method is slightly more efficient than the xtd::string_comparer::compare(const object_t&, consy object_t&) method because no conversion of the `x` and `y` arguments is needed to perform the comparison.
/// @brief When overridden in a derived class, indicates whether two objects are equal.
89
135
/// @param x An object to compare to `y`.
90
136
/// @param y An object to compare to `x`.
@@ -111,7 +157,7 @@ namespace xtd {
111
157
/// @return `true` if `x` and `y` refer to the same object, or `x` and `y` are both the same type of object and those objects are equal; otherwise, `false`.
112
158
/// @remarks The xtd::string_comparer::equals(const string&, const string&) method is slightly more efficient than the xtd::string_comparer::equals(const object_t&, consy object_t&) method because no conversion of the `x` and `y` arguments is needed to perform the comparison.
/// @todo Uncomment following lines when xtd::globalization::culture_info and xtd::globalization::compare_options are developped.
197
+
/*
198
+
/// @brief Creates a xtd::string_comparer object that compares strings according to the rules of a specified culture.
199
+
/// @param culture A culture whose linguistic rules are used to perform a string comparison.
200
+
/// @param ignore_case `true` to specify that comparison operations be case-insensitive; `false` to specify that comparison operations be case-sensitive.
201
+
/// @return A new xtd::string_comparer object that performs string comparisons according to the comparison rules used by the `culture` parameter and the case rule specified by the `ignore_case` parameter.
0 commit comments