Examples Delphi

Title: Do a Case Statement with TEXT values
1st add this function to your app.
CODE
function StringToCaseSelect(Selector : string;
CaseList: array of string): Integer;
var cnt: integer;
begin
Result:=-1;
for cnt:=0 to Length(CaseList)-1 do
begin
if CompareText(Selector, CaseList[cnt]) = 0 then
begin
Result:=cnt;
Break;
end;
end;
end;
Usage:
CODE
case StringToCaseSelect(edit1.Text,['stringtocompareagainst1','stringtocompareagainst2','stringtocompareagainst3']) of
0:ShowMessage('You picked string1') ;
1:ShowMessage('You picked string2') ;
2:ShowMessage('You picked string3') ;
end;
}