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

GRIDVIEW ON ROW DATA BOUND EVENT

 Database Create  Student : roll , name , city , cost  Fix 6 Value  in Database Record  ====================================================...