Example: |
The function StringIx can be used in
case statements for the comparison of strings (thus avoiding cascading if-then-else statements). The following code shows how
to evaluate the input of an edit control:
case StringIx (Edit1.Text, false, ['cmd1', 'cmd2', 'cmd3']) of
1 : begin
// process command 1 here
end;
2 : begin
// process command 2 here
end;
3 : begin
// process command 3 here
end;
else begin
// process unknown command
end;
end;
|