String.EndsWith Method (String, Boolean, CultureInfo)

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

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

member EndsWith : 
        value:string * 
        ignoreCase:bool * 
        culture:CultureInfo -> bool

Parameters

value
Type: System.String

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

ignoreCase
Type: System.Boolean

true to ignore case during the comparison; otherwise, false.

culture
Type: System.Globalization.CultureInfo

Cultural information that determines how this instance and value are compared. If culture is a null reference (Nothing in Visual Basic), the current culture is used.

Return Value

Type: System.Boolean
true if the value parameter matches the end of this string; otherwise, false.

ExceptionCondition
ArgumentNullException

value is a null reference (Nothing in Visual Basic).

This method compares the value parameter to the substring at the end of this string that is the same length as value, and returns a value that indicates whether they are equal. To be equal, value must be a reference to this same instance or match the end of this string.

This method performs a word (culture-sensitive) comparison using the specified casing and culture.

The following example determines whether a string occurs at the end of another string. The EndsWith method is called several times using case sensitivity, case insensitivity, and different cultures that influence the results of the search.

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft