Sha256: db0f819024f320d82be142808281fe0ff91cd9a8f0e97e4dea0d0bad48eea0d8

Contents?: true

Size: 1.08 KB

Versions: 240

Compression:

Stored size: 1.08 KB

Contents

unit uBob;

interface

type
  TBob = Class
  private
    class function IsSilence(aStatement: string): Boolean; static;
    class function IsYelling(aStatement: string): Boolean; static;
    class function IsQuestion(aStatement: string): Boolean; static;
  public
    class function Hey(aStatement: string): string; static;
  End;

implementation
uses RegularExpressions, System.SysUtils;

class function TBob.IsSilence(aStatement: string): Boolean;
begin
  result := aStatement.Trim = '';
end;

class function TBob.IsYelling(aStatement: string): Boolean;
begin
  result := (aStatement.ToUpper = aStatement) and TRegEx.IsMatch(aStatement, '[a-zA-Z]+');
end;

class function TBob.IsQuestion(aStatement: string): Boolean;
begin
  result := aStatement.Trim.EndsWith('?');
end;

class function TBob.Hey(aStatement: string): string;
begin
  if IsSilence(aStatement) then
    result := 'Fine.  Be that way!'
  else
    if IsYelling(aStatement) then
      result := 'Whoa, chill out!'
    else
      if IsQuestion(aStatement) then
        result := 'Sure.'
      else
        result := 'Whatever.';
end;

end.

Version data entries

240 entries across 240 versions & 1 rubygems

Version Path
trackler-2.2.1.72 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.71 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.70 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.69 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.68 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.67 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.66 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.65 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.64 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.63 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.62 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.61 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.60 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.59 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.58 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.57 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.56 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.55 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.54 tracks/delphi/exercises/bob/uBobExample.pas
trackler-2.2.1.53 tracks/delphi/exercises/bob/uBobExample.pas