Sha256: 666163e4d7b8936b2d5519d9612e02aeb1ff147e99637e99f33dda00c6796273
Contents?: true
Size: 731 Bytes
Versions: 75
Compression:
Stored size: 731 Bytes
Contents
public static class Bob { public static string Hey(string statement) { if (IsSilence(statement)) return "Fine. Be that way!"; if (IsYelling(statement)) return "Whoa, chill out!"; if (IsQuestion(statement)) return "Sure."; return "Whatever."; } private static bool IsSilence (string statement) { return statement.Trim() == ""; } private static bool IsYelling (string statement) { return statement.ToUpper() == statement && System.Text.RegularExpressions.Regex.IsMatch(statement, "[a-zA-Z]+"); } private static bool IsQuestion (string statement) { return statement.Trim().EndsWith("?"); } }
Version data entries
75 entries across 75 versions & 1 rubygems