CompareInfo.GetSortKey Method

Definition

Gets a SortKey object for a string.

Overloads

GetSortKey(String)

Gets the sort key for the specified string.

GetSortKey(String, CompareOptions)

Gets a SortKey object for the specified string using the specified CompareOptions value.

GetSortKey(ReadOnlySpan<Char>, Span<Byte>, CompareOptions)

GetSortKey(String)

Gets the sort key for the specified string.

public:
 System::Globalization::SortKey ^ GetSortKey(System::String ^ source);
public:
 virtual System::Globalization::SortKey ^ GetSortKey(System::String ^ source);
public System.Globalization.SortKey GetSortKey (string source);
public virtual System.Globalization.SortKey GetSortKey (string source);
member this.GetSortKey : string -> System.Globalization.SortKey
abstract member GetSortKey : string -> System.Globalization.SortKey
override this.GetSortKey : string -> System.Globalization.SortKey
Public Function GetSortKey (source As String) As SortKey
Public Overridable Function GetSortKey (source As String) As SortKey

Parameters

source
String

The string for which a SortKey object is obtained.

Returns

SortKey

The SortKey object that contains the sort key for the specified string.

Remarks

Each character in a string is given several categories of sort weights, including script, alphabetic, case, and diacritic weights. A sort key is the repository of these weights for a particular string. For example, a sort key might contain a string of alphabetic weights, followed by a string of case weights, and so on. The GetSortKey method is equivalent to the Windows API method LCMapString with the LCMAP_SORTKEY flag.

See also

GetSortKey(String, CompareOptions)

Gets a SortKey object for the specified string using the specified CompareOptions value.

public:
 System::Globalization::SortKey ^ GetSortKey(System::String ^ source, System::Globalization::CompareOptions options);
public:
 virtual System::Globalization::SortKey ^ GetSortKey(System::String ^ source, System::Globalization::CompareOptions options);
public System.Globalization.SortKey GetSortKey (string source, System.Globalization.CompareOptions options);
public virtual System.Globalization.SortKey GetSortKey (string source, System.Globalization.CompareOptions options);
member this.GetSortKey : string * System.Globalization.CompareOptions -> System.Globalization.SortKey
abstract member GetSortKey : string * System.Globalization.CompareOptions -> System.Globalization.SortKey
override this.GetSortKey : string * System.Globalization.CompareOptions -> System.Globalization.SortKey
Public Function GetSortKey (source As String, options As CompareOptions) As SortKey
Public Overridable Function GetSortKey (source As String, options As CompareOptions) As SortKey

Parameters

source
String

The string for which a SortKey object is obtained.

options
CompareOptions

A bitwise combination of one or more of the following enumeration values that define how the sort key is calculated: IgnoreCase, IgnoreSymbols, IgnoreNonSpace, IgnoreWidth, IgnoreKanaType, and StringSort.

Returns

SortKey

The SortKey object that contains the sort key for the specified string.

Exceptions

options contains an invalid CompareOptions value.

Remarks

Each character in a string is given several categories of sort weights, including script, alphabetic, case, and diacritic weights. A sort key is the repository of these weights for a particular string. For example, a sort key might contain a string of alphabetic weights, followed by a string of case weights, and so on. The GetSortKey method is equivalent to the Windows API method LCMapString with the LCMAP_SORTKEY flag.

See also

GetSortKey(ReadOnlySpan<Char>, Span<Byte>, CompareOptions)

public int GetSortKey (ReadOnlySpan<char> source, Span<byte> destination, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None);
member this.GetSortKey : ReadOnlySpan<char> * Span<byte> * System.Globalization.CompareOptions -> int
Public Function GetSortKey (source As ReadOnlySpan(Of Char), destination As Span(Of Byte), Optional options As CompareOptions = System.Globalization.CompareOptions.None) As Integer

Parameters

source
ReadOnlySpan<Char>
destination
Span<Byte>
options
CompareOptions

Returns

Int32

Applies to