String Endswith() - C# Tutorial
C# Course / Strings / String Endswith()

String Endswith()

BLUF: Mastering String Endswith() is essential for building robust applications with the .NET ecosystem. This tutorial provides clear explanations and practical examples to help you understand and apply this C# concept.
Enterprise Development Tip: String Endswith()

C# is a powerful, modern language for enterprise solutions. Discover how String Endswith() enhances your development workflow in the guide below.

The C# EndsWith function is employed to verify if the provided string corresponds to the conclusion of this string. When the specified string is located at the end of this string, it will yield true; otherwise, it will return false.

Signature

Example

public bool EndsWith(String str)
public bool EndsWith(String, Boolean, CultureInfo)
public bool EndsWith (String, StringComparison)?

Parameters

str: It represents a string object that is utilized to determine if a particular string ends with it.

Return

It returns boolean value either true or false.

C# String EndsWith Method Example

Example

using System;  
    public class StringExample  
    {  
        public static void Main(string[] args)  
        {  
             string s1 = "Hello";  
             string s2 = "llo";
             string s3 = "C#";
             Console.WriteLine(s1.EndsWith(s2));
             Console.WriteLine(s1.EndsWith(s3));
        }  
    }

Output:

Output

True
False

Input Required

This code uses input(). Please provide values below:

Logic Practice
Install Logic Practice
Add to home screen for a faster app-like experience