Wednesday, September 26, 2018

Remove Last Character from String in C#, VB.NET with Example

protected void Page_Load(object sender, EventArgs e)
{
string istr = "1,2,3,4,5,6,7,8,9,10,";
string ostr = istr.Remove(istr.Length - 1, 1);
Response.Write(ostr);
}




protected void Page_Load(object sender, EventArgs e)
{
string istr = "1,2,3,4,5,6,7,8,9,10,";
string ostr = istr.Trim(",".ToCharArray());
Response.Write(ostr);
}



protected void Page_Load(object sender, EventArgs e)
{
string istr = "aspdotnet-code.com,";
string ostr = istr.Remove(istr.IndexOf(","));
Response.Write(ostr);
}

No comments:

Post a Comment

Cookies login

  Match login id and password using cookies under 1 minutes if user not input valid I'd pass in 1 min then cookies expired and go to hom...