Wycademy/src/Wycademy/Commands/Services/DamageCalculatorService.cs
/// <summary>
/// Checks if the input is a valid sharpness type.
/// </summary>
/// <param name="input">The string to verify.</param>
/// <returns>The SharpnessType version of the input if it's valid, otherwise null.</returns>
Checks if the input is a valid sharpness type.
Checks if the input is a valid sharpness type .
public SharpnessType? ValidateSharpness(string input)
        {
            switch (input.ToLower())
            {
                case "red":
                case "r":
                    return SharpnessType.Red;
                case "orange":
                case "o":
                    return SharpnessType.Orange;
                case "yellow":
                case "y":
                    return SharpnessType.Yellow;
                case "green":
                case "g":
                    return SharpnessType.Green;
                case "blue":
                case "b":
                    return SharpnessType.Blue;
                case "white":
                case "w":
                    return SharpnessType.White;
                case "purple":
                case "p":
                    return SharpnessType.Purple;
                default:
                    return null;
            }
        }
public SharpnessType ? ValidateSharpness ( string input ) { switch ( input . ToLower ( ) ) { case " " : case " " : return SharpnessType . Red ; case " " : case " " : return SharpnessType . Orange ; case " " : case " " : return SharpnessType . Yellow ; case " " : case " " : return SharpnessType . Green ; case " " : case " " : return SharpnessType . Blue ; case " " : case " " : return SharpnessType . White ; case " " : case " " : return SharpnessType . Purple ; default : return null ; } }
Checks if the input is a valid sharpness type.
Checks if the input is a valid sharpness type .
The SharpnessType version of the input if it's valid, otherwise null.
The SharpnessType version of the input if it ' s valid otherwise null .
input
string
The string to verify.
The string to verify .