How to remove the first and the last character from a string in C#

1 Answer

0 votes
using System;

public class RemoveTheFirstAndTheLastCharacterFromAString_CSharp
{
	public static void Main(string[] args)
	{
		string s = "c# programming";

		s = s.Substring(1, (s.Length - 1) - 1);

		Console.WriteLine(s);
	}
}


/*
run:

# programmin

*/

 



answered Sep 7, 2024 by avibootz

Related questions

1 answer 117 views
1 answer 158 views
1 answer 137 views
1 answer 127 views
1 answer 127 views
...