DEV Community

Discussion on: Daily Challenge #1 - String Peeler

Collapse
 
andreasjakof profile image
Andreas Jakof

in C# as Extension-Method

public static string Peel(this string toPeel)
{
    int residual = toPeel.Length -2;
    if (residual < 1) return null;

    return toPeel.SubString(1,residual); //skip the first and take all but the last char
}