|
Like this?
if @in( 'me' : 'john' : 'mike' : 'home' : 'seth' );
dsply 'Yup, it''s there!';
else;
dsply 'Nope, it''s not there!';
endif;
*=====================================================================
* @in(): Scan for a string in a series of other strings
*=====================================================================
P @in B Export
D PI N
D pSearch 512A Const Varying
D pScan1 512A Const Varying
D pScan2 512A Const Varying Options(*Nopass)
D pScan3 512A Const Varying Options(*Nopass)
D pScan4 512A Const Varying Options(*Nopass)
D pScan5 512A Const Varying Options(*Nopass)
D pScan6 512A Const Varying Options(*Nopass)
D pScan7 512A Const Varying Options(*Nopass)
D pScan8 512A Const Varying Options(*Nopass)
D pScan9 512A Const Varying Options(*Nopass)
D pScan10 512A Const Varying Options(*Nopass)
*---------------------------------------------------------------------
D qusec DS Likeds(qusec_t) Inz(*Likeds)
*---------------------------------------------------------------------
/free
lead = %subst( pSearch : 1 : 1 ) = '%';
trail = %subst( pSearch : %len( pSearch ) : 1 ) = '%';
if ( %scan( pSearch : pScan1 ) > 0 ) or
( %parms > 2 and %scan( pSearch : pScan2 ) > 0 ) or
( %parms > 3 and %scan( pSearch : pScan3 ) > 0 ) or
( %parms > 4 and %scan( pSearch : pScan4 ) > 0 ) or
( %parms > 5 and %scan( pSearch : pScan5 ) > 0 ) or
( %parms > 6 and %scan( pSearch : pScan6 ) > 0 ) or
( %parms > 7 and %scan( pSearch : pScan7 ) > 0 ) or
( %parms > 8 and %scan( pSearch : pScan8 ) > 0 ) or
( %parms > 9 and %scan( pSearch : pScan9 ) > 0 ) or
( %parms > 10 and %scan( pSearch : pScan10 ) > 0 );
return *on;
else;
return *off;
endif;
begsr *pssr;
return *off;
endsr;
/end-free
P E
This one only works with strings and it's pretty basic, but you get the
idea...
Rory
On Fri, Mar 5, 2010 at 1:22 PM, Vern Hamberg <vhamberg@xxxxxxxxxxx> wrote:
[...]But you could have it so
that only the value to test and the first comparison value are required
- the rest could be *NOPASS.
OK - time for real work!!
Vern
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.