System.Globalization.CompareInfo.IsSuffix Method

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

Syntax

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

Parameters

source
The string to search in.
suffix
The string to compare with the end of source.
options
A value that defines how source and suffix should be compared. options is either the enumeration value CompareOptions.Ordinal used by itself, or the bitwise combination of one or more of the following values: CompareOptions.IgnoreCase, CompareOptions.IgnoreSymbols, CompareOptions.IgnoreNonSpace, CompareOptions.IgnoreWidth, and CompareOptions.IgnoreKanaType.

Returns

true if the length of suffix is less than or equal to the length of source and source ends with suffix; otherwise, false.

Remarks

Every string starts and ends with an empty substring (""); therefore, if suffix is an empty string, this method returns true.

The CompareOptions.StringSort value is not valid for this method.

Note:

When possible, you should call string comparison methods that have a parameter of type System.Globalization.CompareOptions to specify the kind of comparison expected. As a general rule, use linguistic options (using the current culture) for comparing strings displayed in the user interface and specify CompareOptions.Ordinal or CompareOptions.OrdinalIgnoreCase for security comparisons.

Requirements

Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0