Bob

in #ita7 days ago

using System;

using System.Text.RegularExpressions;

public static class Bob

{

public static string Response(string statement)

{

    string statementmod= statement.Trim();

    bool isQuestion = statementmod.EndsWith("?");

    int letterCounter = Regex.Matches(statementmod,@"[a-zA-Z]").Count;

    bool hasLetter = letterCounter>0;

    bool hasOnlyUpper = statementmod==statementmod.ToUpper();

    

    if (statementmod=="")

    {

        return "Fine. Be that way!";

    }

    else if(isQuestion && hasOnlyUpper && hasLetter)

    {

        return "Calm down, I know what I'm doing!";

    }



    else if(isQuestion)

    {

        return "Sure.";

    }

    else if(hasLetter && hasOnlyUpper)

    {

        return "Whoa, chill out!";

    }

  else return "Whatever."; 

}

}

Sort:  

Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below


Hey @drago18121996, here is a little bit of BEER from @isnochys for you. Enjoy it!

We love your support by voting @detlev.witness on HIVE .