class CompareInfo

in global :: System . Globalization

Implements a set of methods for culture-sensitive string comparisons.


public int Compare( string string1, int offset1, int length1, string string2, int offset2, int length2 )

Compares a section of one string with a section of another string.

  • string1 The first string to compare.
  • offset1 The zero-based index of the character in at which to start comparing.
  • length1 The number of consecutive characters in to compare.
  • string2 The second string to compare.
  • offset2 The zero-based index of the character in at which to start comparing.
  • length2 The number of consecutive characters in to compare.
  • Returns A 32-bit signed integer indicating the lexical relationship between the two comparands. Value Condition zero The two strings are equal. less than zero The specified section of is less than the specified section of . greater than zero The specified section of is greater than the specified section of .

public int Compare( string string1, int offset1, int length1, string string2, int offset2, int length2, CompareOptions options )

Compares a section of one string with a section of another string using the specified value.

  • string1 The first string to compare.
  • offset1 The zero-based index of the character in at which to start comparing.
  • length1 The number of consecutive characters in to compare.
  • string2 The second string to compare.
  • offset2 The zero-based index of the character in at which to start comparing.
  • length2 The number of consecutive characters in to compare.
  • options A value that defines how and should be compared. is either the enumeration value , or a bitwise combination of one or more of the following values: , , , , , and .
  • Returns A 32-bit signed integer indicating the lexical relationship between the two comparands. Value Condition zero The two strings are equal. less than zero The specified section of is less than the specified section of . greater than zero The specified section of is greater than the specified section of .

public int Compare( string string1, int offset1, string string2, int offset2 )

Compares the end section of a string with the end section of another string.

  • string1 The first string to compare.
  • offset1 The zero-based index of the character in at which to start comparing.
  • string2 The second string to compare.
  • offset2 The zero-based index of the character in at which to start comparing.
  • Returns A 32-bit signed integer indicating the lexical relationship between the two comparands. Value Condition zero The two strings are equal. less than zero The specified section of is less than the specified section of . greater than zero The specified section of is greater than the specified section of .

public int Compare( string string1, int offset1, string string2, int offset2, CompareOptions options )

Compares the end section of a string with the end section of another string using the specified value.

  • string1 The first string to compare.
  • offset1 The zero-based index of the character in at which to start comparing.
  • string2 The second string to compare.
  • offset2 The zero-based index of the character in at which to start comparing.
  • options A value that defines how and should be compared. is either the enumeration value , or a bitwise combination of one or more of the following values: , , , , , and .
  • Returns A 32-bit signed integer indicating the lexical relationship between the two comparands. Value Condition zero The two strings are equal. less than zero The specified section of is less than the specified section of . greater than zero The specified section of is greater than the specified section of .

public int Compare( string string1, string string2 )

Compares two strings.

  • string1 The first string to compare.
  • string2 The second string to compare.
  • Returns A 32-bit signed integer indicating the lexical relationship between the two comparands. Value Condition zero The two strings are equal. less than zero is less than . greater than zero is greater than .

public int Compare( string string1, string string2, CompareOptions options )

Compares two strings using the specified value.

  • string1 The first string to compare.
  • string2 The second string to compare.
  • options A value that defines how and should be compared. is either the enumeration value , or a bitwise combination of one or more of the following values: , , , , , and .
  • Returns A 32-bit signed integer indicating the lexical relationship between the two comparands. Value Condition zero The two strings are equal. less than zero is less than . greater than zero is greater than .

public bool Equals( object value )

Determines whether the specified object is equal to the current object.

  • value The object to compare with the current .
  • Returns if the specified object is equal to the current ; otherwise, .

public static CompareInfo GetCompareInfo( int culture )

Initializes a new object that is associated with the culture with the specified identifier.

  • culture An integer representing the culture identifier.
  • Returns A new object associated with the culture with the specified identifier and using string comparison methods in the current .

public static CompareInfo GetCompareInfo( int culture, Assembly assembly )

Initializes a new object that is associated with the specified culture and that uses string comparison methods in the specified .

  • culture An integer representing the culture identifier.
  • assembly An that contains the string comparison methods to use.
  • Returns A new object associated with the culture with the specified identifier and using string comparison methods in the current .

public static CompareInfo GetCompareInfo( string name )

Initializes a new object that is associated with the culture with the specified name.

  • name A string representing the culture name.
  • Returns A new object associated with the culture with the specified identifier and using string comparison methods in the current .

public static CompareInfo GetCompareInfo( string name, Assembly assembly )

Initializes a new object that is associated with the specified culture and that uses string comparison methods in the specified .

  • name A string representing the culture name.
  • assembly An that contains the string comparison methods to use.
  • Returns A new object associated with the culture with the specified identifier and using string comparison methods in the current .

public int GetHashCode( string source, CompareOptions options )

Gets the hash code for a string based on specified comparison options.

  • source The string whose hash code is to be returned.
  • options A value that determines how strings are compared.
  • Returns A 32-bit signed integer hash code.

public SortKey GetSortKey( string source )

Gets the sort key for the specified string.

  • source The string for which a object is obtained.
  • Returns The object that contains the sort key for the specified string.

public SortKey GetSortKey( string source, CompareOptions options )

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

  • source The string for which a object is obtained.
  • options A bitwise combination of one or more of the following enumeration values that define how the sort key is calculated: , , , , , and .
  • Returns The object that contains the sort key for the specified string.

public int IndexOf( string source, char value )

Searches for the specified character and returns the zero-based index of the first occurrence within the entire source string.

  • source The string to search.
  • value The character to locate within .
  • Returns The zero-based index of the first occurrence of , if found, within ; otherwise, -1. Returns 0 (zero) if is an ignorable character.

public int IndexOf( string source, char value, CompareOptions options )

Searches for the specified character and returns the zero-based index of the first occurrence within the entire source string using the specified value.

  • source The string to search.
  • value The character to locate within .
  • options A value that defines how the strings should be compared. is either the enumeration value , or a bitwise combination of one or more of the following values: , , , , and .
  • Returns The zero-based index of the first occurrence of , if found, within , using the specified comparison options; otherwise, -1. Returns 0 (zero) if is an ignorable character.

public int IndexOf( string source, char value, int startIndex )

Searches for the specified character and returns the zero-based index of the first occurrence within the section of the source string that extends from the specified index to the end of the string.

  • source The string to search.
  • value The character to locate within .
  • startIndex The zero-based starting index of the search.
  • Returns The zero-based index of the first occurrence of , if found, within the section of that extends from to the end of ; otherwise, -1. Returns if is an ignorable character.

public int IndexOf( string source, char value, int startIndex, CompareOptions options )

Searches for the specified character and returns the zero-based index of the first occurrence within the section of the source string that extends from the specified index to the end of the string using the specified value.

  • source The string to search.
  • value The character to locate within .
  • startIndex The zero-based starting index of the search.
  • options A value that defines how and should be compared. is either the enumeration value , or a bitwise combination of one or more of the following values: , , , , and .
  • Returns The zero-based index of the first occurrence of , if found, within the section of that extends from to the end of , using the specified comparison options; otherwise, -1. Returns if is an ignorable character.

public int IndexOf( string source, char value, int startIndex, int count )

Searches for the specified character and returns the zero-based index of the first occurrence within the section of the source string that starts at the specified index and contains the specified number of elements.

  • source The string to search.
  • value The character to locate within .
  • startIndex The zero-based starting index of the search.
  • count The number of elements in the section to search.
  • Returns The zero-based index of the first occurrence of , if found, within the section of that starts at and contains the number of elements specified by ; otherwise, -1. Returns if is an ignorable character.

public int IndexOf( string source, char value, int startIndex, int count, CompareOptions options )

Searches for the specified character and returns the zero-based index of the first occurrence within the section of the source string that starts at the specified index and contains the specified number of elements using the specified value.

  • source The string to search.
  • value The character to locate within .
  • startIndex The zero-based starting index of the search.
  • count The number of elements in the section to search.
  • options A value that defines how and should be compared. is either the enumeration value , or a bitwise combination of one or more of the following values: , , , , and .
  • Returns The zero-based index of the first occurrence of , if found, within the section of that starts at and contains the number of elements specified by , using the specified comparison options; otherwise, -1. Returns if is an ignorable character.

public int IndexOf( string source, string value )

Searches for the specified substring and returns the zero-based index of the first occurrence within the entire source string.

  • source The string to search.
  • value The string to locate within .
  • Returns The zero-based index of the first occurrence of , if found, within ; otherwise, -1. Returns 0 (zero) if is an ignorable character.

public int IndexOf( string source, string value, CompareOptions options )

Searches for the specified substring and returns the zero-based index of the first occurrence within the entire source string using the specified value.

  • source The string to search.
  • value The string to locate within .
  • options A value that defines how and should be compared. is either the enumeration value , or a bitwise combination of one or more of the following values: , , , , and .
  • Returns The zero-based index of the first occurrence of , if found, within , using the specified comparison options; otherwise, -1. Returns 0 (zero) if is an ignorable character.

public int IndexOf( string source, string value, int startIndex )

Searches for the specified substring and returns the zero-based index of the first occurrence within the section of the source string that extends from the specified index to the end of the string.

  • source The string to search.
  • value The string to locate within .
  • startIndex The zero-based starting index of the search.
  • Returns The zero-based index of the first occurrence of , if found, within the section of that extends from to the end of ; otherwise, -1. Returns if is an ignorable character.

public int IndexOf( string source, string value, int startIndex, CompareOptions options )

Searches for the specified substring and returns the zero-based index of the first occurrence within the section of the source string that extends from the specified index to the end of the string using the specified value.

  • source The string to search.
  • value The string to locate within .
  • startIndex The zero-based starting index of the search.
  • options A value that defines how and should be compared. is either the enumeration value , or a bitwise combination of one or more of the following values: , , , , and .
  • Returns The zero-based index of the first occurrence of , if found, within the section of that extends from to the end of , using the specified comparison options; otherwise, -1. Returns if is an ignorable character.

public int IndexOf( string source, string value, int startIndex, int count )

Searches for the specified substring and returns the zero-based index of the first occurrence within the section of the source string that starts at the specified index and contains the specified number of elements.

  • source The string to search.
  • value The string to locate within .
  • startIndex The zero-based starting index of the search.
  • count The number of elements in the section to search.
  • Returns The zero-based index of the first occurrence of , if found, within the section of that starts at and contains the number of elements specified by ; otherwise, -1. Returns if is an ignorable character.

public int IndexOf( string source, string value, int startIndex, int count, CompareOptions options )

Searches for the specified substring and returns the zero-based index of the first occurrence within the section of the source string that starts at the specified index and contains the specified number of elements using the specified value.

  • source The string to search.
  • value The string to locate within .
  • startIndex The zero-based starting index of the search.
  • count The number of elements in the section to search.
  • options A value that defines how and should be compared. is either the enumeration value , or a bitwise combination of one or more of the following values: , , , , and .
  • Returns The zero-based index of the first occurrence of , if found, within the section of that starts at and contains the number of elements specified by , using the specified comparison options; otherwise, -1. Returns if is an ignorable character.

public bool IsPrefix( string source, string prefix )

Determines whether the specified source string starts with the specified prefix.

  • source The string to search in.
  • prefix The string to compare with the beginning of .
  • Returns if the length of is less than or equal to the length of and starts with ; otherwise, .

public bool IsPrefix( string source, string prefix, CompareOptions options )

Determines whether the specified source string starts with the specified prefix using the specified value.

  • source The string to search in.
  • prefix The string to compare with the beginning of .
  • options A value that defines how and should be compared. is either the enumeration value , or a bitwise combination of one or more of the following values: , , , , and .
  • Returns if the length of is less than or equal to the length of and starts with ; otherwise, .

public static bool IsSortable( char ch )

Indicates whether a specified Unicode character is sortable.

  • ch A Unicode character.
  • Returns if the parameter is sortable; otherwise, .

public static bool IsSortable( string text )

Indicates whether a specified Unicode string is sortable.

  • text A string of zero or more Unicode characters.
  • Returns if the parameter is not an empty string ("") and all the Unicode characters in are sortable; otherwise, .

public bool IsSuffix( string source, string suffix )

Determines whether the specified source string ends with the specified suffix.

  • source The string to search in.
  • suffix The string to compare with the end of .
  • Returns if the length of is less than or equal to the length of and ends with ; otherwise, .

public bool IsSuffix( string source, string suffix, CompareOptions options )

Determines whether the specified source string ends with the specified suffix using the specified value.

  • source The string to search in.
  • suffix The string to compare with the end of .
  • options A value that defines how and should be compared. is either the enumeration value used by itself, or the bitwise combination of one or more of the following values: , , , , and .
  • Returns if the length of is less than or equal to the length of and ends with ; otherwise, .

public int LastIndexOf( string source, char value )

Searches for the specified character and returns the zero-based index of the last occurrence within the entire source string.

  • source The string to search.
  • value The character to locate within .
  • Returns The zero-based index of the last occurrence of , if found, within ; otherwise, -1.

public int LastIndexOf( string source, char value, CompareOptions options )

Searches for the specified character and returns the zero-based index of the last occurrence within the entire source string using the specified value.

  • source The string to search.
  • value The character to locate within .
  • options A value that defines how and should be compared. is either the enumeration value , or a bitwise combination of one or more of the following values: , , , , and .
  • Returns The zero-based index of the last occurrence of , if found, within , using the specified comparison options; otherwise, -1.

public int LastIndexOf( string source, char value, int startIndex )

Searches for the specified character and returns the zero-based index of the last occurrence within the section of the source string that extends from the beginning of the string to the specified index.

  • source The string to search.
  • value The character to locate within .
  • startIndex The zero-based starting index of the backward search.
  • Returns The zero-based index of the last occurrence of , if found, within the section of that extends from the beginning of to ; otherwise, -1. Returns if is an ignorable character.

public int LastIndexOf( string source, char value, int startIndex, CompareOptions options )

Searches for the specified character and returns the zero-based index of the last occurrence within the section of the source string that extends from the beginning of the string to the specified index using the specified value.

  • source The string to search.
  • value The character to locate within .
  • startIndex The zero-based starting index of the backward search.
  • options A value that defines how and should be compared. is either the enumeration value , or a bitwise combination of one or more of the following values: , , , , and .
  • Returns The zero-based index of the last occurrence of , if found, within the section of that extends from the beginning of to , using the specified comparison options; otherwise, -1. Returns if is an ignorable character.

public int LastIndexOf( string source, char value, int startIndex, int count )

Searches for the specified character and returns the zero-based index of the last occurrence within the section of the source string that contains the specified number of elements and ends at the specified index.

  • source The string to search.
  • value The character to locate within .
  • startIndex The zero-based starting index of the backward search.
  • count The number of elements in the section to search.
  • Returns The zero-based index of the last occurrence of , if found, within the section of that contains the number of elements specified by and that ends at ; otherwise, -1. Returns if is an ignorable character.

public int LastIndexOf( string source, char value, int startIndex, int count, CompareOptions options )

Searches for the specified character and returns the zero-based index of the last occurrence within the section of the source string that contains the specified number of elements and ends at the specified index using the specified value.

  • source The string to search.
  • value The character to locate within .
  • startIndex The zero-based starting index of the backward search.
  • count The number of elements in the section to search.
  • options A value that defines how and should be compared. is either the enumeration value , or a bitwise combination of one or more of the following values: , , , , and .
  • Returns The zero-based index of the last occurrence of , if found, within the section of that contains the number of elements specified by and that ends at , using the specified comparison options; otherwise, -1. Returns if is an ignorable character.

public int LastIndexOf( string source, string value )

Searches for the specified substring and returns the zero-based index of the last occurrence within the entire source string.

  • source The string to search.
  • value The string to locate within .
  • Returns The zero-based index of the last occurrence of , if found, within ; otherwise, -1.

public int LastIndexOf( string source, string value, CompareOptions options )

Searches for the specified substring and returns the zero-based index of the last occurrence within the entire source string using the specified value.

  • source The string to search.
  • value The string to locate within .
  • options A value that defines how and should be compared. is either the enumeration value , or a bitwise combination of one or more of the following values: , , , , and .
  • Returns The zero-based index of the last occurrence of , if found, within , using the specified comparison options; otherwise, -1.

public int LastIndexOf( string source, string value, int startIndex )

Searches for the specified substring and returns the zero-based index of the last occurrence within the section of the source string that extends from the beginning of the string to the specified index.

  • source The string to search.
  • value The string to locate within .
  • startIndex The zero-based starting index of the backward search.
  • Returns The zero-based index of the last occurrence of , if found, within the section of that extends from the beginning of to ; otherwise, -1. Returns if is an ignorable character.

public int LastIndexOf( string source, string value, int startIndex, CompareOptions options )

Searches for the specified substring and returns the zero-based index of the last occurrence within the section of the source string that extends from the beginning of the string to the specified index using the specified value.

  • source The string to search.
  • value The string to locate within .
  • startIndex The zero-based starting index of the backward search.
  • options A value that defines how and should be compared. is either the enumeration value , or a bitwise combination of one or more of the following values: , , , , and .
  • Returns The zero-based index of the last occurrence of , if found, within the section of that extends from the beginning of to , using the specified comparison options; otherwise, -1. Returns if is an ignorable character.

public int LastIndexOf( string source, string value, int startIndex, int count )

Searches for the specified substring and returns the zero-based index of the last occurrence within the section of the source string that contains the specified number of elements and ends at the specified index.

  • source The string to search.
  • value The string to locate within .
  • startIndex The zero-based starting index of the backward search.
  • count The number of elements in the section to search.
  • Returns The zero-based index of the last occurrence of , if found, within the section of that contains the number of elements specified by and that ends at ; otherwise, -1. Returns if is an ignorable character.

public int LastIndexOf( string source, string value, int startIndex, int count, CompareOptions options )

Searches for the specified substring and returns the zero-based index of the last occurrence within the section of the source string that contains the specified number of elements and ends at the specified index using the specified value.

  • source The string to search.
  • value The string to locate within .
  • startIndex The zero-based starting index of the backward search.
  • count The number of elements in the section to search.
  • options A value that defines how and should be compared. is either the enumeration value , or a bitwise combination of one or more of the following values: , , , , and .
  • Returns The zero-based index of the last occurrence of , if found, within the section of that contains the number of elements specified by and that ends at , using the specified comparison options; otherwise, -1. Returns if is an ignorable character.

public int LCID { get; }

Gets the properly formed culture identifier for the current .

  • Returns The properly formed culture identifier for the current .

public string Name { get; }

Gets the name of the culture used for sorting operations by this object.

  • Returns The name of a culture.

public SortVersion Version { get; }

Gets information about the version of Unicode used for comparing and sorting strings.

  • Returns An object that contains information about the Unicode version used for comparing and sorting strings.

public Type GetType( )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public int GetHashCode( ReadOnlySpan<char> source, CompareOptions options )

😔 No documentation found.

public bool IsSuffix( ReadOnlySpan<char> source, ReadOnlySpan<char> suffix, CompareOptions options = None )

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.

public bool IsSuffix( ReadOnlySpan<char> source, ReadOnlySpan<char> suffix, CompareOptions options, ref int matchLength )

😔 No documentation found.

public int GetSortKeyLength( ReadOnlySpan<char> source, CompareOptions options = None )

😔 No documentation found.

public int GetSortKey( ReadOnlySpan<char> source, Span<byte> destination, CompareOptions options = None )

😔 No documentation found.

public int LastIndexOf( ReadOnlySpan<char> source, ReadOnlySpan<char> value, CompareOptions options, ref int matchLength )

😔 No documentation found.

public static bool IsSortable( Rune value )

😔 No documentation found.

public int LastIndexOf( ReadOnlySpan<char> source, Rune value, CompareOptions options = None )

😔 No documentation found.

public int IndexOf( ReadOnlySpan<char> source, Rune value, CompareOptions options = None )

😔 No documentation found.

public int LastIndexOf( ReadOnlySpan<char> source, ReadOnlySpan<char> value, CompareOptions options = None )

😔 No documentation found.

public bool IsPrefix( ReadOnlySpan<char> source, ReadOnlySpan<char> prefix, CompareOptions options = None )

😔 No documentation found.

public int Compare( ReadOnlySpan<char> string1, ReadOnlySpan<char> string2, CompareOptions options = None )

😔 No documentation found.

public bool IsPrefix( ReadOnlySpan<char> source, ReadOnlySpan<char> prefix, CompareOptions options, ref int matchLength )

😔 No documentation found.

public int IndexOf( ReadOnlySpan<char> source, ReadOnlySpan<char> value, CompareOptions options = None )

😔 No documentation found.

public static bool IsSortable( ReadOnlySpan<char> text )

😔 No documentation found.

public int IndexOf( ReadOnlySpan<char> source, ReadOnlySpan<char> value, CompareOptions options, ref int matchLength )

😔 No documentation found.