Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need function that checks if chars exist in string ($,in
Message
De
16/04/2002 14:19:26
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00645231
Message ID:
00645608
Vues:
14
FANTASTIC! Thank you much, Sergey!


>There's no such function but you can write one
* Function CheckDept
>LPARAMETERS tcDept, tcString
>LOCAL laList[1], lnInd, llFound
>
>Alines(laList, Chrtran(tcDept, ",", Chr(13)))
>
>llFound = .F.
>
>FOR lnInd=1 TO ALEN(laList)
>	llFound = llFound Or (laList[lnInd] $ tcString)
>ENDFOR
>RETURN llFound
>
>? CheckDept('SH,BR', 'OP101,TH310,XB171')
>? CheckDept('TH,BR', 'OP101,TH310,XB171')
>
>>myString='OP101,TH310,XB171'
>>myDept='TH,BR'
>>Is there a function that returns .T. if either "TH" or "BR" is in myString?
>>
>>?INLIST(myString,'TH,BR') returns .F.
>>?INLIST(myString,'TH','BR') returns .F.
>>?'TH,BR' $ myString returns .F.
>>
>>myString is a string, listing (dept code + product code)s, separated by commas. The first 2 chars is Dept code, followed by the product code (example: OP is the dept code, 101 is the product code, etc.)
>>myDept is a string, listing department codes (separated by commas).
>>What I'm looking for is a function that will return .T. if any one of the department codes listed in myDept is in myString.
>>
>>Is there such a thing?
>>Thanks all!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform