- Get link
- X
- Other Apps
C# - Remove Last Character from String in VB.NET
By: Suresh Dasari Mar 13, 2013
Categories: C#.Net, Code Snippets, VB.NET
Introduction:
Here I will explain how to remove last character from string in c#, vb.net using asp.net.
Here I will explain how to remove last character from string in c#, vb.net using asp.net.
Description:
In previous posts I explained jQuery Remove first or last characters from string, Delete selected rows from datatable in c#, vb.net, jQuery get number of facebook likes, shares, comments count for url and many articles relating to Asp.net, Gridview, Ajax, JQuery. Now I will explain how to remove last character from string in c#, vb.net using asp.net.
To implement this functionality we have different methods
Method 1 in C#
In previous posts I explained jQuery Remove first or last characters from string, Delete selected rows from datatable in c#, vb.net, jQuery get number of facebook likes, shares, comments count for url and many articles relating to Asp.net, Gridview, Ajax, JQuery. Now I will explain how to remove last character from string in c#, vb.net using asp.net.
To implement this functionality we have different methods
Method 1 in C#
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 Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim istr As String = "1,2,3,4,5,6,7,8,9,10,"
Dim ostr As String = istr.Remove(istr.Length - 1, 1)
Response.Write(ostr)
End Sub
|
Method 2 in C#
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);
}
|
Method 2 in VB.NET
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim istr As String = "1,2,3,4,5,6,7,8,9,10,"
Dim ostr As String = istr.Trim(",".ToCharArray())
Response.Write(ostr)
End Sub
|
Comments
Post a Comment