Or alternatively:

var
  sl : TStringList;
...
  sl.CommaText := 'Fred,Jim,Wally,Elephants';
  case sl.IndexOf(MyString) of
    -1: // not found
     0:
     ...
  end;

Steve

> -----Original Message-----
> From: Dave [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 7 June 2001 20:35
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: String in Case Statement
> 
> 
> You could create a string with all possibilities at regular intervals,
> 
> Possibilities := 'Fred      Jim       Wally     Elephants ' ;
> 
> then
> 
> case pos(MyString, Possibilities) div 10 of
>   0:
>   1...
> end ;
> 
> Dave
> ----- Original Message -----
> From: "Reginald Ebenezer" <[EMAIL PROTECTED]>
> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
> Sent: Thursday, June 07, 2001 6:45 PM
> Subject: [DUG]: String in Case Statement
> 
> 
> > Hi
> >
> >   I understand that string cannot be used in a Case 
> statement because
> > delphi does not support it. A work around for the same is 
> using an If
> > <Condition> then. I feel this is not a very neat substitute for Case
> > Statement. Can any one suggest some other way of doing the 
> same. Thanks
> > in advance.
> >
> > Regards
> > Ebenezer
> > 
> --------------------------------------------------------------
> ------------
> -
> >     New Zealand Delphi Users group - Delphi List - 
> [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
> > To UnSub, send email to: [EMAIL PROTECTED]
> > with body of "unsubscribe delphi"
> >
> 
> --------------------------------------------------------------
> -------------
>     New Zealand Delphi Users group - Delphi List - 
> [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED] 
> with body of "unsubscribe delphi"
> 
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to