Removing First and Last Character from String In C#
Removing First and Last Character from String In C#
Logic on .Cs page
protected void Page_Load(object sender, EventArgs e)
{
remove_sym();
}
public void remove_sym()
{
string str = "sd,ff,gg,hh,jj,kk,";
string str2 = ",sd,ff,gg,hh,jj,kk,";
string str3 = ",sd,ff,gg,hh,jj,kk,";
Response.Write("Actual string Is : " + str);
Response.Write("<br/>");
Response.Write("Removing Last Chracter : "+str.Remove(str.LastIndexOf(","), 1));
Response.Write("<br/>");
Response.Write("<br/>");
Response.Write("<br/>");
Response.Write("Actual string Is : " + str2);
Response.Write("<br/>");
Response.Write("Removing First Chracter : "+str2.Remove(str2.IndexOf(","), 1));
Response.Write("<br/>");
Response.Write("<br/>");
Response.Write("<br/>");
Response.Write("Actual string Is : " + str3);
Response.Write("<br/>");
str3 = str3.Remove(str3.IndexOf(","), 1);
Response.Write("Removing First and Last Chracter : "+str3.Remove(str3.LastIndexOf(","), 1));
}
Comments
Post a Comment