c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
c# .net

How to remove last three character of input string using Substring?

| | ASP , ASP-NET , CSharp

If you want to remove the last threecharacter of the string object. Here this example codedemonstrates us to remove all the character, excluding the last three using c#ASP.net framework c#.

    protected void Button1_Click(object sender, EventArgs e)

    {

    string input = "AppleBallCat";

    string sub = input.Substring(0,input.Length - 3);

    Console.WriteLine("Substring: {0}", sub);

     }

 

Output: 

Substring: AppleBall