Sha256: 82dc79b558df65381502275e7fabb2d07bc843711bf5d0214cf8c557c7c5dfa9
Contents?: true
Size: 936 Bytes
Versions: 396
Compression:
Stored size: 936 Bytes
Contents
package; class Bob { private static inline var WHATEVER = "Whatever."; private static inline var SURE = "Sure."; private static inline var CHILL = "Whoa, chill out!"; private static inline var FINE = "Fine. Be that way!"; public static function hey(sentence : String) : String { var trimmed : String = StringTools.trim(sentence); if (isQuestion(trimmed)) { return SURE; } if (isShouting(trimmed)) { return CHILL; } if (isSilence(trimmed )) { return FINE; } return WHATEVER; } private static function isShouting(sentence : String) : Bool { return sentence.toUpperCase() == sentence && sentence.toLowerCase() != sentence; } private static function isQuestion(sentence : String) : Bool { return StringTools.endsWith(sentence, "?") && !isShouting(sentence); } private static function isSilence(sentence : String) : Bool { return sentence == ""; } }
Version data entries
396 entries across 396 versions & 1 rubygems