Description:
Code:
In
this example we explain that how to remove last character from string in C# in
asp.net or remove last character from string variable value in C#.in C# there
is lots of the function is available so we can easily remove last character
from string by using “Remove” or “Trim” or “IndexOf” properties.
Here
we explain that all the methods of the how to remove last character from the
string in C#.
(1)
string istr = "1,2,3,4,5,6,7,8,9,10,";
string ostr = istr.Remove(istr.Length
- 1, 1);
Response.Write(ostr);
(2)
string istr = "1,2,3,4,5,6,7,8,9,10,";
string ostr = istr.Trim(",".ToCharArray());
Response.Write(ostr);
(3)
string istr = "Hello World Hows You,";
string ostr = istr.Remove(istr.IndexOf(","));
Response.Write(ostr);
0 comments:
Post a Comment