Skip to content

Instantly share code, notes, and snippets.

@panther99
Created February 1, 2020 20:48
String peeler challenge solution
using System;
public class StringPeeler
{
public static string RemoveFirstAndLastLetter(string text)
{
string trimmedText = text.Trim();
return trimmedText.Length < 3
? null
: trimmedText.Substring(1, trimmedText.Length - 2);
}
public static void Main()
{
string sentence = "I am just playing my best move";
Console.WriteLine(Program.RemoveFirstAndLastLetter(sentence));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment