Represents a string comparison operation that uses specific case and culture-based or ordinal comparison rules
allowing comparing strings by string, StringSegment and ReadOnlySpan<char> instances.
See the static properties for more details.
See the static properties for more details.
Inheritance Hierarchy
KGySoft.CoreLibrariesStringSegmentComparer
Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 7.0.0-preview.3
Syntax
[SerializableAttribute] public abstract class StringSegmentComparer : IEqualityComparer<StringSegment>, IComparer<StringSegment>, IEqualityComparer<string>, IComparer<string>, IEqualityComparer, IComparer
The StringSegmentComparer type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() | StringSegmentComparer | Initializes a new instance of the StringSegmentComparer class |
Properties
Name | Description | |
---|---|---|
![]() ![]() | CurrentCulture |
Gets a StringSegmentComparer object that performs a case-sensitive string comparison using the word comparison rules of the current culture.
Depending on the targeted platform, the GetHashCode(StringSegment) method might allocate a new string. In .NET Core 3.0 and above none of the members of the returned StringSegmentComparer will allocate new strings. |
![]() ![]() | CurrentCultureIgnoreCase |
Gets a StringSegmentComparer object that performs case-insensitive string comparisons using the word comparison rules of the current culture.
Depending on the targeted platform, the GetHashCode(StringSegment) method might allocate a new string. In .NET Core 3.0 and above none of the members of the returned StringSegmentComparer will allocate new strings. |
![]() ![]() | InvariantCulture |
Gets a StringSegmentComparer object that performs a case-sensitive string comparison using the word comparison rules of the invariant culture.
Depending on the targeted platform, the GetHashCode(StringSegment) method might allocate a new string. In .NET Core 3.0 and above none of the members of the returned StringSegmentComparer will allocate new strings. |
![]() ![]() | InvariantCultureIgnoreCase |
Gets a StringSegmentComparer object that performs a case-insensitive string comparison using the word comparison rules of the invariant culture.
Depending on the targeted platform, the GetHashCode(StringSegment) method might allocate a new string. In .NET Core 3.0 and above none of the members of the returned StringSegmentComparer will allocate new strings. |
![]() ![]() | Ordinal |
Gets a StringSegmentComparer object that performs a case-sensitive ordinal string comparison.
The methods of the returned StringSegmentComparer instance can be called with string, StringSegment and ReadOnlySpan<char> parameter values, which will not allocate new strings on any platform. |
![]() ![]() | OrdinalIgnoreCase |
Gets a StringSegmentComparer object that performs a case-insensitive ordinal string comparison.
The methods of the returned StringSegmentComparer instance can be called with string, StringSegment and ReadOnlySpan<char> parameter values, which will not allocate new strings on any platform. |
![]() ![]() | OrdinalIgnoreCaseRandomized |
Gets a StringSegmentComparer object that performs a case-insensitive ordinal string comparison. The returned comparer is functionally equivalent
with OrdinalIgnoreCase but it ensures that the hash code of a specific string is stable only within the same process and AppDomain.
|
![]() ![]() | OrdinalRandomized |
Methods
Name | Description | |
---|---|---|
![]() | Compare(Object, Object) |
When overridden in a derived class, compares two objects and returns an indication of their relative sort order.
|
![]() | Compare(ReadOnlySpanChar, ReadOnlySpanChar) |
When overridden in a derived class, compares two ReadOnlySpan<char> instances and returns an indication of their relative sort order.
|
![]() | Compare(String, String) |
When overridden in a derived class, compares two string instances and returns an indication of their relative sort order.
|
![]() | Compare(StringSegment, StringSegment) |
When overridden in a derived class, compares two StringSegment instances and returns an indication of their relative sort order.
|
![]() ![]() | Create |
Creates a StringSegmentComparer object that compares strings according to the rules of a specified culture.
Please note that the returned StringSegmentComparer may allocate new strings in some cases when targeting older frameworks. See the Remarks section for details. |
![]() | Equals(Object, Object) |
When overridden in a derived class, indicates whether two objects are equal.
|
![]() | Equals(ReadOnlySpanChar, ReadOnlySpanChar) |
When overridden in a derived class, indicates whether two ReadOnlySpan<char> instances are equal.
|
![]() | Equals(String, String) |
When overridden in a derived class, indicates whether two string instances are equal.
|
![]() | Equals(StringSegment, StringSegment) |
When overridden in a derived class, indicates whether two StringSegment instances are equal.
|
![]() ![]() | FromComparison |
Gets a StringSegmentComparer instance based on the specified comparison.
Please note that the returned StringSegmentComparer may allocate new strings in some cases. See the description of the properties for more details. |
![]() | GetHashCode(Object) |
When overridden in a derived class, gets the hash code for the specified object.
|
![]() | GetHashCode(ReadOnlySpanChar) |
When overridden in a derived class, gets the hash code for the specified ReadOnlySpan<char>.
|
![]() | GetHashCode(String) |
When overridden in a derived class, gets the hash code for the specified string.
|
![]() | GetHashCode(StringSegment) |
When overridden in a derived class, gets the hash code for the specified StringSegment.
|
Extension Methods
Name | Description | |
---|---|---|
![]() | Convert(Type, CultureInfo) | Overloaded.
Converts an Object specified in the obj parameter to the desired targetType.
(Defined by ObjectExtensions.)See the Examples section of the generic ConvertTTarget(Object, CultureInfo) overload for an example. |
![]() ![]() | ConvertTTarget(CultureInfo) | Overloaded.
Converts an Object specified in the obj parameter to the desired TTarget.
(Defined by ObjectExtensions.)See the Remarks section for details. |
![]() | In |
Gets whether item is among the elements of set.
(Defined by ObjectExtensions.)See the Examples section of the generic InT(T, T) overload for an example. |
![]() | TryConvert(Type, Object) | Overloaded.
Tries to convert an Object specified in the obj parameter to the desired targetType.
(Defined by ObjectExtensions.)See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example. |
![]() | TryConvert(Type, CultureInfo, Object) | Overloaded.
Tries to convert an Object specified in the obj parameter to the desired targetType.
(Defined by ObjectExtensions.)See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example. |
![]() | TryConvertTTarget(TTarget) | Overloaded.
Tries to convert an Object specified in the obj parameter to the desired TTarget.
(Defined by ObjectExtensions.)See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example. |
![]() | TryConvertTTarget(CultureInfo, TTarget) | Overloaded.
Tries to convert an Object specified in the obj parameter to the desired TTarget.
(Defined by ObjectExtensions.)See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example. |
See Also