Windows apps
Collapse the table of content
Expand the table of content
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, Boolean, CultureInfo)

Note: This method is new in the .NET Framework version 2.0.

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

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

public bool EndsWith (
	string value,
	bool ignoreCase,
	CultureInfo culture
public boolean EndsWith (
	String value, 
	boolean ignoreCase, 
	CultureInfo culture
public function EndsWith (
	value : String, 
	ignoreCase : boolean, 
	culture : CultureInfo
) : boolean



A String object to compare to.


true to ignore case when comparing this instance and value; otherwise, false.


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

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

Exception typeCondition


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 code 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.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0

.NET Compact Framework

Supported in: 2.0
© 2018 Microsoft