navigation
c# .net

How to Remove the last char of String in C#?

| | CSharp

 Remove last character from string using c#. If we want to remove the last char of my string whatever it is. So we want if my string is "12342" became "1234". 


 


var input = "12342";
var output = input.Substring(0, input.Length - 1);

or

var output = input.Remove(input.Length - 1); 

output:


 1234