How to remove the last character of the string in asp.net c#

In this article, I will remove the last charter of the string that means we reduce the length of only one character of the string.


Source code:-
using System;
using System.Collections.Generic;

using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class remove : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       
       string text = "Neeraj Srivastava";
        text = text.Remove(text.Length - 1);
        string output = text;
    }
}

Out-Put:-



How to remove the last character of the string in asp.net c# How to remove the last character of the string in asp.net c# Reviewed by NEERAJ SRIVASTAVA on 7:35:00 PM Rating: 5

No comments:

Powered by Blogger.