String Ordinal для удобного распределения case

Hello.pas
program Hello;
 
{$H+}
 
uses SysUtils;
 
function StrOrd(const AKey: string; const AValues: array of string): integer;
var i: integer;
begin
    StrOrd := -1;
    for i := 0 to sizeof(AValues) div sizeof(AValues[0]) - 1 do begin
        if (CompareText(AKey, AValues[i]) = 0) then begin
            StrOrd := i;
            Break;
        end;
    end;
end;
 
 
var s: string;
 
begin
    ReadLn(s); s := TrimRight(s);
 
    case StrOrd(s, ['hello', 'hi', 'bye']) of
        0 : writeln ('Hello World');
        1 : writeln ('Hi World');
        2 : writeln ('Bye World');
    else
        writeln('sorry bad input');
    end;
end.