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

ADVANCE 2025

 HTML TABLE SCROLL BAR  <style>      .table-container {             width: 100%;             overflow-x: auto; /* Enables horizontal s...