> You could write a function to do return the matching index, then "case"
> that... MyFunction(AString: String; AStringList: TStringlist): Integer

you'd be better using the IndexOf procedure which should be faster as it deals
with the stringlist internally... However if it's a function you want how about
abandoning stringlists entirely.

function ArrayIndexOf(const S :String; const A :array of String):Integer;
var
  I :Integer;
begin
  I :=High(A);
  while I>=0 do if A[I]=S then break;
  Result := I;
end;

allowing

case ArrayIndexOf(MyVariable,['Hello','Goodbye']) of
  0: Show_Hello;
  1: Show_Goodbye;
end;

--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to