Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Globalization.​CompareInfo

Assembly: System.Runtime

Inheritance: object → CompareInfo

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

Properties

public int
LCID
Gets the properly formed culture identifier for the current <see cref="T:System.Globalization.CompareInfo" /> .
public string
Name
Gets the name of the culture used for sorting operations by this <see cref="T:System.Globalization.CompareInfo" /> object.
public SortVersion
Version
Gets information about the version of Unicode used for comparing and sorting strings.

Methods

public int
Compare​(ReadOnlySpan`1 string1, ReadOnlySpan`1 string2, CompareOptions options = 0)
public int
Compare​(string string1, int offset1, int length1, string string2, int offset2, int length2)
string1 The first string to compare.
offset1 The zero-based index of the character in <paramref name="string1" /> at which to start comparing.
length1 The number of consecutive characters in <paramref name="string1" /> to compare.
string2 The second string to compare.
offset2 The zero-based index of the character in <paramref name="string2" /> at which to start comparing.
length2 The number of consecutive characters in <paramref name="string2" /> to compare.
Returns A 32-bit signed integer indicating the lexical relationship between the two comparands. <list type="table"> <listheader> <term> Value</term> <description> Condition</description> </listheader> <item> <term> zero</term> <description> The two strings are equal.</description> </item> <item> <term> less than zero</term> <description> The specified section of <paramref name="string1" /> is less than the specified section of <paramref name="string2" />.</description> </item> <item> <term> greater than zero</term> <description> The specified section of <paramref name="string1" /> is greater than the specified section of <paramref name="string2" />.</description> </item> </list>
Compares a section of one string with a section of another string.
public int
Compare​(string string1, int offset1, int length1, string string2, int offset2, int length2, CompareOptions options)
string1 The first string to compare.
offset1 The zero-based index of the character in <paramref name="string1" /> at which to start comparing.
length1 The number of consecutive characters in <paramref name="string1" /> to compare.
string2 The second string to compare.
offset2 The zero-based index of the character in <paramref name="string2" /> at which to start comparing.
length2 The number of consecutive characters in <paramref name="string2" /> to compare.
options A value that defines how <paramref name="string1" /> and <paramref name="string2" /> should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> , or a bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> , and <see cref="F:System.Globalization.CompareOptions.StringSort" /> .
Returns A 32-bit signed integer indicating the lexical relationship between the two comparands. <list type="table"> <listheader> <term> Value</term> <description> Condition</description> </listheader> <item> <term> zero</term> <description> The two strings are equal.</description> </item> <item> <term> less than zero</term> <description> The specified section of <paramref name="string1" /> is less than the specified section of <paramref name="string2" />.</description> </item> <item> <term> greater than zero</term> <description> The specified section of <paramref name="string1" /> is greater than the specified section of <paramref name="string2" />.</description> </item> </list>
Compares a section of one string with a section of another string using the specified <see cref="T:System.Globalization.CompareOptions" /> value.
public int
Compare​(string string1, int offset1, string string2, int offset2)
string1 The first string to compare.
offset1 The zero-based index of the character in <paramref name="string1" /> at which to start comparing.
string2 The second string to compare.
offset2 The zero-based index of the character in <paramref name="string2" /> at which to start comparing.
Returns A 32-bit signed integer indicating the lexical relationship between the two comparands. <list type="table"> <listheader> <term> Value</term> <description> Condition</description> </listheader> <item> <term> zero</term> <description> The two strings are equal.</description> </item> <item> <term> less than zero</term> <description> The specified section of <paramref name="string1" /> is less than the specified section of <paramref name="string2" />.</description> </item> <item> <term> greater than zero</term> <description> The specified section of <paramref name="string1" /> is greater than the specified section of <paramref name="string2" />.</description> </item> </list>
Compares the end section of a string with the end section of another string.
public int
Compare​(string string1, int offset1, string string2, int offset2, CompareOptions options)
string1 The first string to compare.
offset1 The zero-based index of the character in <paramref name="string1" /> at which to start comparing.
string2 The second string to compare.
offset2 The zero-based index of the character in <paramref name="string2" /> at which to start comparing.
options A value that defines how <paramref name="string1" /> and <paramref name="string2" /> should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> , or a bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> , and <see cref="F:System.Globalization.CompareOptions.StringSort" /> .
Returns A 32-bit signed integer indicating the lexical relationship between the two comparands. <list type="table"> <listheader> <term> Value</term> <description> Condition</description> </listheader> <item> <term> zero</term> <description> The two strings are equal.</description> </item> <item> <term> less than zero</term> <description> The specified section of <paramref name="string1" /> is less than the specified section of <paramref name="string2" />.</description> </item> <item> <term> greater than zero</term> <description> The specified section of <paramref name="string1" /> is greater than the specified section of <paramref name="string2" />.</description> </item> </list>
Compares the end section of a string with the end section of another string using the specified <see cref="T:System.Globalization.CompareOptions" /> value.
public int
Compare​(string string1, string string2)
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. <list type="table"> <listheader> <term> Value</term> <description> Condition</description> </listheader> <item> <term> zero</term> <description> The two strings are equal.</description> </item> <item> <term> less than zero</term> <description> <paramref name="string1" /> is less than <paramref name="string2" />.</description> </item> <item> <term> greater than zero</term> <description> <paramref name="string1" /> is greater than <paramref name="string2" />.</description> </item> </list>
Compares two strings.
public int
Compare​(string string1, string string2, CompareOptions options)
string1 The first string to compare.
string2 The second string to compare.
options A value that defines how <paramref name="string1" /> and <paramref name="string2" /> should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> , or a bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> , and <see cref="F:System.Globalization.CompareOptions.StringSort" /> .
Returns A 32-bit signed integer indicating the lexical relationship between the two comparands. <list type="table"> <listheader> <term> Value</term> <description> Condition</description> </listheader> <item> <term> zero</term> <description> The two strings are equal.</description> </item> <item> <term> less than zero</term> <description> <paramref name="string1" /> is less than <paramref name="string2" />.</description> </item> <item> <term> greater than zero</term> <description> <paramref name="string1" /> is greater than <paramref name="string2" />.</description> </item> </list>
Compares two strings using the specified <see cref="T:System.Globalization.CompareOptions" /> value.
public bool
Equals​(object value)
value The object to compare with the current <see cref="T:System.Globalization.CompareInfo" /> .
Returns <see langword="true" /> if the specified object is equal to the current <see cref="T:System.Globalization.CompareInfo" /> ; otherwise, <see langword="false" /> .
Determines whether the specified object is equal to the current <see cref="T:System.Globalization.CompareInfo" /> object.
public int
GetHashCode​()
Returns A hash code for the current <see cref="T:System.Globalization.CompareInfo" /> .
Serves as a hash function for the current <see cref="T:System.Globalization.CompareInfo" /> for hashing algorithms and data structures, such as a hash table.
public int
GetHashCode​(ReadOnlySpan`1 source, CompareOptions options)
public int
GetHashCode​(string source, CompareOptions 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.
Gets the hash code for a string based on specified comparison options.
public int
GetSortKey​(ReadOnlySpan`1 source, Span`1 destination, CompareOptions options = 0)
public SortKey
GetSortKey​(string source)
source The string for which a <see cref="T:System.Globalization.SortKey" /> object is obtained.
Returns The <see cref="T:System.Globalization.SortKey" /> object that contains the sort key for the specified string.
Gets the sort key for the specified string.
public SortKey
GetSortKey​(string source, CompareOptions options)
source The string for which a <see cref="T:System.Globalization.SortKey" /> object is obtained.
options A bitwise combination of one or more of the following enumeration values that define how the sort key is calculated: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> , and <see cref="F:System.Globalization.CompareOptions.StringSort" /> .
Returns The <see cref="T:System.Globalization.SortKey" /> object that contains the sort key for the specified string.
Gets a <see cref="T:System.Globalization.SortKey" /> object for the specified string using the specified <see cref="T:System.Globalization.CompareOptions" /> value.
public int
GetSortKeyLength​(ReadOnlySpan`1 source, CompareOptions options = 0)
public int
IndexOf​(ReadOnlySpan`1 source, ReadOnlySpan`1 value, CompareOptions options = 0)
public int
IndexOf​(ReadOnlySpan`1 source, ReadOnlySpan`1 value, CompareOptions options, Int32& matchLength)
public int
IndexOf​(ReadOnlySpan`1 source, Text.Rune value, CompareOptions options = 0)
public int
IndexOf​(string source, char value)
source The string to search.
value The character to locate within <paramref name="source" /> .
Returns The zero-based index of the first occurrence of <paramref name="value" /> , if found, within <paramref name="source" /> ; otherwise, -1. Returns 0 (zero) if <paramref name="value" /> is an ignorable character.
Searches for the specified character and returns the zero-based index of the first occurrence within the entire source string.
public int
IndexOf​(string source, char value, CompareOptions options)
source The string to search.
value The character to locate within <paramref name="source" /> .
options A value that defines how the strings should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> , or a bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , and <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> .
Returns The zero-based index of the first occurrence of <paramref name="value" /> , if found, within <paramref name="source" /> , using the specified comparison options; otherwise, -1. Returns 0 (zero) if <paramref name="value" /> is an ignorable character.
Searches for the specified character and returns the zero-based index of the first occurrence within the entire source string using the specified <see cref="T:System.Globalization.CompareOptions" /> value.
public int
IndexOf​(string source, char value, int startIndex)
source The string to search.
value The character to locate within <paramref name="source" /> .
startIndex The zero-based starting index of the search.
Returns The zero-based index of the first occurrence of <paramref name="value" /> , if found, within the section of <paramref name="source" /> that extends from <paramref name="startIndex" /> to the end of <paramref name="source" /> ; otherwise, -1. Returns <paramref name="startIndex" /> if <paramref name="value" /> is an ignorable character.
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.
public int
IndexOf​(string source, char value, int startIndex, CompareOptions options)
source The string to search.
value The character to locate within <paramref name="source" /> .
startIndex The zero-based starting index of the search.
options A value that defines how <paramref name="source" /> and <paramref name="value" /> should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> , or a bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , and <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> .
Returns The zero-based index of the first occurrence of <paramref name="value" /> , if found, within the section of <paramref name="source" /> that extends from <paramref name="startIndex" /> to the end of <paramref name="source" /> , using the specified comparison options; otherwise, -1. Returns <paramref name="startIndex" /> if <paramref name="value" /> is an ignorable character.
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 <see cref="T:System.Globalization.CompareOptions" /> value.
public int
IndexOf​(string source, char value, int startIndex, int count)
source The string to search.
value The character to locate within <paramref name="source" /> .
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 <paramref name="value" /> , if found, within the section of <paramref name="source" /> that starts at <paramref name="startIndex" /> and contains the number of elements specified by <paramref name="count" /> ; otherwise, -1. Returns <paramref name="startIndex" /> if <paramref name="value" /> is an ignorable character.
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.
public int
IndexOf​(string source, char value, int startIndex, int count, CompareOptions options)
source The string to search.
value The character to locate within <paramref name="source" /> .
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 <paramref name="source" /> and <paramref name="value" /> should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> , or a bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , and <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> .
Returns The zero-based index of the first occurrence of <paramref name="value" /> , if found, within the section of <paramref name="source" /> that starts at <paramref name="startIndex" /> and contains the number of elements specified by <paramref name="count" /> , using the specified comparison options; otherwise, -1. Returns <paramref name="startIndex" /> if <paramref name="value" /> is an ignorable character.
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 <see cref="T:System.Globalization.CompareOptions" /> value.
public int
IndexOf​(string source, string value)
source The string to search.
value The string to locate within <paramref name="source" /> .
Returns The zero-based index of the first occurrence of <paramref name="value" /> , if found, within <paramref name="source" /> ; otherwise, -1. Returns 0 (zero) if <paramref name="value" /> is an ignorable character.
Searches for the specified substring and returns the zero-based index of the first occurrence within the entire source string.
public int
IndexOf​(string source, string value, CompareOptions options)
source The string to search.
value The string to locate within <paramref name="source" /> .
options A value that defines how <paramref name="source" /> and <paramref name="value" /> should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> , or a bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , and <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> .
Returns The zero-based index of the first occurrence of <paramref name="value" /> , if found, within <paramref name="source" /> , using the specified comparison options; otherwise, -1. Returns 0 (zero) if <paramref name="value" /> is an ignorable character.
Searches for the specified substring and returns the zero-based index of the first occurrence within the entire source string using the specified <see cref="T:System.Globalization.CompareOptions" /> value.
public int
IndexOf​(string source, string value, int startIndex)
source The string to search.
value The string to locate within <paramref name="source" /> .
startIndex The zero-based starting index of the search.
Returns The zero-based index of the first occurrence of <paramref name="value" /> , if found, within the section of <paramref name="source" /> that extends from <paramref name="startIndex" /> to the end of <paramref name="source" /> ; otherwise, -1. Returns <paramref name="startIndex" /> if <paramref name="value" /> is an ignorable character.
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.
public int
IndexOf​(string source, string value, int startIndex, CompareOptions options)
source The string to search.
value The string to locate within <paramref name="source" /> .
startIndex The zero-based starting index of the search.
options A value that defines how <paramref name="source" /> and <paramref name="value" /> should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> , or a bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , and <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> .
Returns The zero-based index of the first occurrence of <paramref name="value" /> , if found, within the section of <paramref name="source" /> that extends from <paramref name="startIndex" /> to the end of <paramref name="source" /> , using the specified comparison options; otherwise, -1. Returns <paramref name="startIndex" /> if <paramref name="value" /> is an ignorable character.
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 <see cref="T:System.Globalization.CompareOptions" /> value.
public int
IndexOf​(string source, string value, int startIndex, int count)
source The string to search.
value The string to locate within <paramref name="source" /> .
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 <paramref name="value" /> , if found, within the section of <paramref name="source" /> that starts at <paramref name="startIndex" /> and contains the number of elements specified by <paramref name="count" /> ; otherwise, -1. Returns <paramref name="startIndex" /> if <paramref name="value" /> is an ignorable character.
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.
public int
IndexOf​(string source, string value, int startIndex, int count, CompareOptions options)
source The string to search.
value The string to locate within <paramref name="source" /> .
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 <paramref name="source" /> and <paramref name="value" /> should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> , or a bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , and <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> .
Returns The zero-based index of the first occurrence of <paramref name="value" /> , if found, within the section of <paramref name="source" /> that starts at <paramref name="startIndex" /> and contains the number of elements specified by <paramref name="count" /> , using the specified comparison options; otherwise, -1. Returns <paramref name="startIndex" /> if <paramref name="value" /> is an ignorable character.
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 <see cref="T:System.Globalization.CompareOptions" /> value.
public bool
IsPrefix​(ReadOnlySpan`1 source, ReadOnlySpan`1 prefix, CompareOptions options = 0)
public bool
IsPrefix​(ReadOnlySpan`1 source, ReadOnlySpan`1 prefix, CompareOptions options, Int32& matchLength)
public bool
IsPrefix​(string source, string prefix)
source The string to search in.
prefix The string to compare with the beginning of <paramref name="source" /> .
Returns <see langword="true" /> if the length of <paramref name="prefix" /> is less than or equal to the length of <paramref name="source" /> and <paramref name="source" /> starts with <paramref name="prefix" /> ; otherwise, <see langword="false" /> .
Determines whether the specified source string starts with the specified prefix.
public bool
IsPrefix​(string source, string prefix, CompareOptions options)
source The string to search in.
prefix The string to compare with the beginning of <paramref name="source" /> .
options A value that defines how <paramref name="source" /> and <paramref name="prefix" /> should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> , or a bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , and <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> .
Returns <see langword="true" /> if the length of <paramref name="prefix" /> is less than or equal to the length of <paramref name="source" /> and <paramref name="source" /> starts with <paramref name="prefix" /> ; otherwise, <see langword="false" /> .
Determines whether the specified source string starts with the specified prefix using the specified <see cref="T:System.Globalization.CompareOptions" /> value.
public bool
IsSuffix​(ReadOnlySpan`1 source, ReadOnlySpan`1 suffix, CompareOptions options = 0)
public bool
IsSuffix​(ReadOnlySpan`1 source, ReadOnlySpan`1 suffix, CompareOptions options, Int32& matchLength)
public bool
IsSuffix​(string source, string suffix)
source The string to search in.
suffix The string to compare with the end of <paramref name="source" /> .
Returns <see langword="true" /> if the length of <paramref name="suffix" /> is less than or equal to the length of <paramref name="source" /> and <paramref name="source" /> ends with <paramref name="suffix" /> ; otherwise, <see langword="false" /> .
Determines whether the specified source string ends with the specified suffix.
public bool
IsSuffix​(string source, string suffix, CompareOptions options)
source The string to search in.
suffix The string to compare with the end of <paramref name="source" /> .
options A value that defines how <paramref name="source" /> and <paramref name="suffix" /> should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> used by itself, or the bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , and <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> .
Returns <see langword="true" /> if the length of <paramref name="suffix" /> is less than or equal to the length of <paramref name="source" /> and <paramref name="source" /> ends with <paramref name="suffix" /> ; otherwise, <see langword="false" /> .
Determines whether the specified source string ends with the specified suffix using the specified <see cref="T:System.Globalization.CompareOptions" /> value.
public int
LastIndexOf​(ReadOnlySpan`1 source, ReadOnlySpan`1 value, CompareOptions options = 0)
public int
LastIndexOf​(ReadOnlySpan`1 source, ReadOnlySpan`1 value, CompareOptions options, Int32& matchLength)
public int
LastIndexOf​(ReadOnlySpan`1 source, Text.Rune value, CompareOptions options = 0)
public int
LastIndexOf​(string source, char value)
source The string to search.
value The character to locate within <paramref name="source" /> .
Returns The zero-based index of the last occurrence of <paramref name="value" /> , if found, within <paramref name="source" /> ; otherwise, -1.
Searches for the specified character and returns the zero-based index of the last occurrence within the entire source string.
public int
LastIndexOf​(string source, char value, CompareOptions options)
source The string to search.
value The character to locate within <paramref name="source" /> .
options A value that defines how <paramref name="source" /> and <paramref name="value" /> should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> , or a bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , and <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> .
Returns The zero-based index of the last occurrence of <paramref name="value" /> , if found, within <paramref name="source" /> , using the specified comparison options; otherwise, -1.
Searches for the specified character and returns the zero-based index of the last occurrence within the entire source string using the specified <see cref="T:System.Globalization.CompareOptions" /> value.
public int
LastIndexOf​(string source, char value, int startIndex)
source The string to search.
value The character to locate within <paramref name="source" /> .
startIndex The zero-based starting index of the backward search.
Returns The zero-based index of the last occurrence of <paramref name="value" /> , if found, within the section of <paramref name="source" /> that extends from the beginning of <paramref name="source" /> to <paramref name="startIndex" /> ; otherwise, -1. Returns <paramref name="startIndex" /> if <paramref name="value" /> is an ignorable character.
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.
public int
LastIndexOf​(string source, char value, int startIndex, CompareOptions options)
source The string to search.
value The character to locate within <paramref name="source" /> .
startIndex The zero-based starting index of the backward search.
options A value that defines how <paramref name="source" /> and <paramref name="value" /> should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> , or a bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , and <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> .
Returns The zero-based index of the last occurrence of <paramref name="value" /> , if found, within the section of <paramref name="source" /> that extends from the beginning of <paramref name="source" /> to <paramref name="startIndex" /> , using the specified comparison options; otherwise, -1. Returns <paramref name="startIndex" /> if <paramref name="value" /> is an ignorable character.
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 <see cref="T:System.Globalization.CompareOptions" /> value.
public int
LastIndexOf​(string source, char value, int startIndex, int count)
source The string to search.
value The character to locate within <paramref name="source" /> .
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 <paramref name="value" /> , if found, within the section of <paramref name="source" /> that contains the number of elements specified by <paramref name="count" /> and that ends at <paramref name="startIndex" /> ; otherwise, -1. Returns <paramref name="startIndex" /> if <paramref name="value" /> is an ignorable character.
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.
public int
LastIndexOf​(string source, char value, int startIndex, int count, CompareOptions options)
source The string to search.
value The character to locate within <paramref name="source" /> .
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 <paramref name="source" /> and <paramref name="value" /> should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> , or a bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , and <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> .
Returns The zero-based index of the last occurrence of <paramref name="value" /> , if found, within the section of <paramref name="source" /> that contains the number of elements specified by <paramref name="count" /> and that ends at <paramref name="startIndex" /> , using the specified comparison options; otherwise, -1. Returns <paramref name="startIndex" /> if <paramref name="value" /> is an ignorable character.
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 <see cref="T:System.Globalization.CompareOptions" /> value.
public int
LastIndexOf​(string source, string value)
source The string to search.
value The string to locate within <paramref name="source" /> .
Returns The zero-based index of the last occurrence of <paramref name="value" /> , if found, within <paramref name="source" /> ; otherwise, -1.
Searches for the specified substring and returns the zero-based index of the last occurrence within the entire source string.
public int
LastIndexOf​(string source, string value, CompareOptions options)
source The string to search.
value The string to locate within <paramref name="source" /> .
options A value that defines how <paramref name="source" /> and <paramref name="value" /> should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> , or a bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , and <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> .
Returns The zero-based index of the last occurrence of <paramref name="value" /> , if found, within <paramref name="source" /> , using the specified comparison options; otherwise, -1.
Searches for the specified substring and returns the zero-based index of the last occurrence within the entire source string using the specified <see cref="T:System.Globalization.CompareOptions" /> value.
public int
LastIndexOf​(string source, string value, int startIndex)
source The string to search.
value The string to locate within <paramref name="source" /> .
startIndex The zero-based starting index of the backward search.
Returns The zero-based index of the last occurrence of <paramref name="value" /> , if found, within the section of <paramref name="source" /> that extends from the beginning of <paramref name="source" /> to <paramref name="startIndex" /> ; otherwise, -1. Returns <paramref name="startIndex" /> if <paramref name="value" /> is an ignorable character.
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.
public int
LastIndexOf​(string source, string value, int startIndex, CompareOptions options)
source The string to search.
value The string to locate within <paramref name="source" /> .
startIndex The zero-based starting index of the backward search.
options A value that defines how <paramref name="source" /> and <paramref name="value" /> should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> , or a bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , and <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> .
Returns The zero-based index of the last occurrence of <paramref name="value" /> , if found, within the section of <paramref name="source" /> that extends from the beginning of <paramref name="source" /> to <paramref name="startIndex" /> , using the specified comparison options; otherwise, -1. Returns <paramref name="startIndex" /> if <paramref name="value" /> is an ignorable character.
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 <see cref="T:System.Globalization.CompareOptions" /> value.
public int
LastIndexOf​(string source, string value, int startIndex, int count)
source The string to search.
value The string to locate within <paramref name="source" /> .
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 <paramref name="value" /> , if found, within the section of <paramref name="source" /> that contains the number of elements specified by <paramref name="count" /> and that ends at <paramref name="startIndex" /> ; otherwise, -1. Returns <paramref name="startIndex" /> if <paramref name="value" /> is an ignorable character.
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.
public int
LastIndexOf​(string source, string value, int startIndex, int count, CompareOptions options)
source The string to search.
value The string to locate within <paramref name="source" /> .
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 <paramref name="source" /> and <paramref name="value" /> should be compared. <paramref name="options" /> is either the enumeration value <see cref="F:System.Globalization.CompareOptions.Ordinal" /> , or a bitwise combination of one or more of the following values: <see cref="F:System.Globalization.CompareOptions.IgnoreCase" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreSymbols" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreNonSpace" /> , <see cref="F:System.Globalization.CompareOptions.IgnoreWidth" /> , and <see cref="F:System.Globalization.CompareOptions.IgnoreKanaType" /> .
Returns The zero-based index of the last occurrence of <paramref name="value" /> , if found, within the section of <paramref name="source" /> that contains the number of elements specified by <paramref name="count" /> and that ends at <paramref name="startIndex" /> , using the specified comparison options; otherwise, -1. Returns <paramref name="startIndex" /> if <paramref name="value" /> is an ignorable character.
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 <see cref="T:System.Globalization.CompareOptions" /> value.
public string
ToString​()
Returns A string that represents the current <see cref="T:System.Globalization.CompareInfo" /> object.
Returns a string that represents the current <see cref="T:System.Globalization.CompareInfo" /> object.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .