Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

String.EndsWith Method (String, StringComparison)

 

Determines whether the end of this string instance matches the specified string when compared using the specified comparison option.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

[<ComVisibleAttribute(false)>]
member EndsWith : 
        value:string *
        comparisonType:StringComparison -> bool

Parameters

value
Type: System.String

The string to compare to the substring at the end of this instance.

comparisonType
Type: System.StringComparison

One of the enumeration values that determines how this string and value are compared.

Return Value

Type: System.Boolean

true if the value parameter matches the end of this string; otherwise, false.

Exception Condition
ArgumentNullException

value is null.

ArgumentException

comparisonType is not a StringComparison value.

The EndsWith method compares the value parameter to the substring at the end of this string and returns a value that indicates whether they are equal. To be equal, value must be a reference to this same string, must be the empty string (""), or must match the end of this string. The type of comparison performed by the EndsWith method depends on the value of the comparisonTypeparameter.

The following example determines whether a string ends with a particular substring. The results are affected by the choice of culture, whether case is ignored, and whether an ordinal comparison is performed.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show:
© 2017 Microsoft